NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"self" ascending:YES];
sortedFloats = [Arr_distance sortedArrayUsingDescriptors:
[NSMutableArray arrayWithObject:sortDescriptor]];
Run Code Online (Sandbox Code Playgroud)
sortedFloatsNSMutableArray 在哪里,Arr_distance也是NSMutableArray
我收到警告Incompatible pointer types assigning to 'NSMutableArray ' from 'NSArray ' 仍然结果是正确的,但是警告是什么?
我想从tableView中删除选定的行.我想为用户提供在他滑动或轻弹手指时删除行的功能.我知道编辑样式,它提供了一个带有-ve标志的圆形红色按钮.
我试过这段代码:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView beginUpdates];
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Do whatever data deletion you need to do...
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationTop];
}
[tableView endUpdates];
[tableView reloadData];
}
Run Code Online (Sandbox Code Playgroud)
我得到删除按钮,但当我点击它SIGABRT错误就在那里.