Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First you have to take the values of selected row; This is in your TABLEVIEWCONTROLLER</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath { if(listObject.count!=0){ //you will get the object from the list ObjectType *selectedObject=(ObjectType*)[listObject objectAtIndex:indexPath.row]; //you can call your view controller (in my example init with nib) yourDetailViewController = [[YourDetailViewController alloc] initWithNibName:@"YourDetailViewControllerNib" bundle:nil]; //you can set your selected object in order to use it on your detail view controller yourDetailViewController.objectSelected = selectedObject; [self.navigationController yourDetailViewController animated:YES]; } } </code></pre> <p>And this is in your DETAILVIEWCONTROLLER;</p> <pre><code>-(void)objectUpdate:(Object*)selectedObject withDBPath:(NSString *)dbPath{ NSError *errMsg; if (sqlite3_open([dbPath UTF8String], &amp;database) == SQLITE_OK) { const char *sql_stmt = [@"CREATE TABLE IF NOT EXISTS iosobjecttable (yourcolumns INTEGER PRIMARY KEY NOT NULL , youranothercolumn VARCHAR)" cStringUsingEncoding:NSUTF8StringEncoding]; if (sqlite3_exec(database, sql_stmt, NULL, NULL, (__bridge void*)errMsg) == SQLITE_OK) { // SQL statement execution succeeded } if(updateStmt == nil) { NSString *querySQL = [NSString stringWithFormat: @"update iosobject set youranothercolumn=%@ where p_event_id=%@", object.changedcomlumn,object.objectid]; const char *query_sql = [querySQL UTF8String]; if(sqlite3_prepare_v2(database, query_sql, -1, &amp;updateStmt, NULL) != SQLITE_OK){ NSAssert1(0, @"Error while creating update statement. '%s'", sqlite3_errmsg(database)); //NSLog(@"%@",errMsg); } } @try { if(SQLITE_DONE != sqlite3_step(updateStmt)){ NSAssert1(0, @"Error while updating data. '%s'", sqlite3_errmsg(database)); //NSLog(@"%@",errMsg); } else{ //NSLog(@"updatingupdatingedelementt %@",tEvent.eventid); } sqlite3_reset(updateStmt); } @catch (NSException* ex) { //NSLog(@"Error while updating data. '%s'", sqlite3_errmsg(database)); } } } </code></pre> <p>and how you call this function is like this;</p> <pre><code>AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; NSString *dbPath=[appDelegate getDBPath]; [self objectUpdate:objectUpdate withDBPath:dbPath]; </code></pre> <p>And in app delegate you have to write getDBPath in app delegate;</p> <pre><code> - (NSString *) getDBPath { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES); NSString *documentsDir = [paths objectAtIndex:0]; return [documentsDir stringByAppendingPathComponent:@"yourdbname.sqlite"]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload