我有一个带有队列的图片应用程序。我希望用户能够从中删除图像,但不能删除正在上传的图像。所以我有这样的事情:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
//NSString *indexPathString = [NSString stringWithFormat:@"%d", indexPath];
NSString *theObject = [processList objectAtIndex:0];
NSLog(@"theObject: %@", theObject);
NSString *theStatus;
NSArray *resultstwoo = [database executeQuery:@"SELECT * FROM processes WHERE image=?", theObject];
for (NSDictionary *rowtwoo in resultstwoo) {
theStatus = [rowtwoo valueForKey:@"status"];
}
NSLog(@"the status: %@", theStatus);
if ([theStatus isEqualToString:@"Uploading..."]) {
return UITableViewCellEditingStyleNone;
} else if ([theStatus isEqualToString:@"Resizing..."]) {
return UITableViewCellEditingStyleNone;
} else {
return UITableViewCellEditingStyleDelete;
}
}
即使我的NSLog说它是“正在上传...”,它仍会显示删除按钮。
请帮助,谢谢:
库尔顿!
答案 0 :(得分:0)
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
如果上传会让它返回NO吗?