0
有時,當執行UITableAction的塊時,整個UITableView會凍結,它不會響應水龍頭或滾動。然而,頁面的其餘部分是響應式的。該行爲看起來像這樣UITableViewAction有時會凍結表
-(NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
__weak ServiceOrderDetailsViewController* weakSelf = self;
UITableViewRowAction *button = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Mark as Complete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath)
{
if (indexPath.section < weakSelf.sections.count && indexPath.row > 0)
{
NSString* key = weakSelf.sections[indexPath.section];
if (indexPath.row - 1 < [weakSelf.datasource[key] count])
{
//Action
}
}
dispatch_async(dispatch_get_main_queue(),^
{
[weakSelf.UITableView_Bins setEditing:NO animated:YES];
[weakSelf.UITableView_Bins beginUpdates];
[weakSelf.UITableView_Bins reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
[weakSelf.UITableView_Bins endUpdates];
});
}];
button.backgroundColor = [UIColor InTrackGreenColor];
return @[button];
}
如果我刪除reloadRows此問題不會發生,但是然後單元格的內容不會更新。