想要实现一个UIButton,用户一按就能删除cell。
- (IBAction)deleteCell:(NSIndexPath *)indexPath {
MainViewController *view = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
[view.nameArray removeObjectAtIndex:indexPath.row];
[view.priceArray removeObjectAtIndex:indexPath.row];
[view.mainTable deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight];
}
但是报错,我觉得是指定indexPath的错误,不知道怎么解决。
请高手指教。