UITableViewCell中删除cell

想要实现一个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的错误,不知道怎么解决。

请高手指教。

你看看这个能否作为参考:
http://www.cnblogs.com/hellocby/archive/2012/05/23/2514291.html