Php iOS使用http post/get从tableView远程删除行
我可以通过jSON文件在tableView中显示来自外部DB的数据,但我遇到的问题是,我不知道如何使用objective-c从数据库中删除数据,删除的PHP文件已准备就绪,并且正在工作,它的格式如下: 问题是: 如何在代码中执行上述URL 正如我所认为的,应该在这里插入一些内容,以便我可以执行URL: 一种可能的解决办法:Php iOS使用http post/get从tableView远程删除行,php,ios,objective-c,uitableview,Php,Ios,Objective C,Uitableview,我可以通过jSON文件在tableView中显示来自外部DB的数据,但我遇到的问题是,我不知道如何使用objective-c从数据库中删除数据,删除的PHP文件已准备就绪,并且正在工作,它的格式如下: 问题是: 如何在代码中执行上述URL 正如我所认为的,应该在这里插入一些内容,以便我可以执行URL: 一种可能的解决办法: 1. In `commitEditingStyle` delegate don't remove the record from your datasource. 2. I
1. In `commitEditingStyle` delegate don't remove the record from your datasource.
2. Instead keep the `indexPath.row` and `indexPath.section` and `hit the url`.
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Hit url here
}
3. In service response callback, once it is successful, use the data gathered
in step 2 and eliminate it from tableView datasource.
4. Reload tableView data.
希望有帮助 我知道如何建立NSURLCONNECTION,但我不知道在tableView中插入它的确切位置,所以我执行URL。我想说,您可以在[self.destinations\u history removeObjectAtIndex:indexPath.row]之前发出删除URL请求。
- (void)tableView:(UITableView *)tableView commitEditingStyle: (UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[self.destinations_history removeObjectAtIndex:indexPath.row];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
NSLog(@"create");
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
[self.tableView reloadData];
}
1. In `commitEditingStyle` delegate don't remove the record from your datasource.
2. Instead keep the `indexPath.row` and `indexPath.section` and `hit the url`.
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Hit url here
}
3. In service response callback, once it is successful, use the data gathered
in step 2 and eliminate it from tableView datasource.
4. Reload tableView data.