我是iOS的初學者。我正在執行滑動刪除選項。我想在刪除行之前顯示一個警報視圖。我如何執行此操作。在iOS中滑動刪除時顯示提醒
- (void)tableView:(UITableView *)tableView commitEditingStyle:
(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"%@",collisionsArray);
if (editingStyle == UITableViewCellEditingStyleDelete)
{
NSUserDefaults *userinfo = [NSUserDefaults standardUserDefaults];
NSString *userId = [userinfo valueForKey:@"user_id"];
if(userId!=nil)
{
NSDictionary* dict = [collisionsArray objectAtIndex:indexPath.section];
collisionId = [NSString stringWithFormat:@"%@",[dict valueForKey:@"collisionId"]];
NSLog(@"%@",collisionId);
// removes saved datas from database
BOOL result = [database removeCollisionDetails:collisionId:@"accident_report"];
if(result)
{
[[SHKActivityIndicator currentIndicator]
displayCompleted:NSLocalizedString(@"val_sucess_vehicle", nil)];
[self.navigationController popViewControllerAnimated:YES];
}
else
{
[[SHKActivityIndicator currentIndicator]
displayCompleted:NSLocalizedString(@"val_error", nil)];
}
}
}
[self.tableView reloadData];
}
感謝您解決問題... – Chan
如果問題解決,那麼請不要忘了查馬克的答案,這可能幫助其他用戶找到解決方案迅速:) – Ashutosh