I am new in iPhone programming and I dont know much about database. I am making an iphone application in which I have used database for storing the contacts, whenever I add new contact It get add to the table view where others contacts are displaying. But I want that If I dont need any contact then by clicking on the row of the table view it must delete from tableview as well as from database. How Can I do it. Please help me.
Thanks alot.
you can use this code
- (void)viewDidLoad {
self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
;
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
}
}
Here's a good tutorial of sqlite: http://www.icodeblog.com/2008/08/19/iphone-programming-tutorial-creating-a-todo-list-using-sqlite-part-1/
you'll use sqlite3_prepare_v2
but I know there are some helper frameworks out there that people will recommend (I haven't used them so can't comment)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.