你好
我想通过 UITableView 从 NSMutableArray 中删除项目,但是应用程序崩溃了。崩溃是“ 0 objc_msgSend
”。
这是我的代码伙计们:
- (void)viewDidLoad
{
paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
path = [basePath stringByAppendingPathComponent:@"favoris.plist"];
dict = [[NSArray arrayWithContentsOfFile:path] mutableCopy];
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
[dict removeObjectAtIndex:indexPath.row];
[self.tableView reloadData];
}
谢谢