我正在尝试将数据推送到 modalviewcontroller,如 pushviewcontroller。我有以下代码来调用 modalviewcontroller。它将调用视图并将数据作为文本字段插入。我将其保存为字符串,然后尝试插入数据库。为了存储在数据库中,我需要发送唯一键来插入记录。
-(void) editNote{
TextViewController * vc = [(TextViewController *)[TextViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
[self.navigationController presentModalViewController:nav animated:YES];
[vc release];
}
在保存选项上,我确实调用了以下方法。所以现在点击编辑按钮我想推送记录数据,以便我可以在保存功能中使用它:
-(IBAction) save{
self.description = self.textFieldBeingEdited.text;
NSString *description_query = [NSString stringWithFormat:@"INSERT OR REPLACE INTO NET (ID,DESCRIPTION) VALUES ('%@','%@');",rec.id, self.description] ;
const char *sql_description = [description_query UTF8String];
sqlite3_exec(db, sql_description, NULL, NULL, NULL);
[[self parentViewController] dismissModalViewControllerAnimated:YES];
}
有没有人遇到过这样的问题?