Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Table data does not reload dynamically
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
- listOfNotes=[[NSMutableArray alloc]init];
- NSString *docsDir;
- NSArray *dirPaths;
- dirPaths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
- docsDir=[dirPaths objectAtIndex:0];
- databasePath=[[NSString alloc]initWithString:[docsDir stringByAppendingPathComponent:@"myApplicationDatabase.sqlite"]];
- const char *dbPath=[databasePath UTF8String];
- if (sqlite3_open(dbPath, &contactDB)==SQLITE_OK) {
- const char *sql="select notes from message";
- sqlite3_stmt *statement;
- if (sqlite3_prepare_v2(contactDB, sql, -1, &statement, NULL)==SQLITE_OK){
- while (sqlite3_step(statement)==SQLITE_ROW) {
- NSString *list=[NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, 0)];
- [listOfNotes addObject:list];
- }
- sqlite3_finalize(statement);
- }
- sqlite3_close(contactDB);
- }
- tableData=[[NSMutableArray alloc]init];
- [tableData addObjectsFromArray:listOfNotes];
- }
- [table reloadData];
Add Comment
Please, Sign In to add comment