相关疑难解决方法(0)

在deleteRowsAtIndexPaths上崩溃

当我从表中删除行时,我的应用程序崩溃了.以下是检测到错误和堆栈跟踪的源代码.感谢名单!

//delete row from database
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"\ncommitEditingStyle");

    //delete user from Users table with specified ID
    if(editingStyle == UITableViewCellEditingStyleDelete) 
    {

        //Get the object to delete from the array.
        [dbManager open: @DB_FILE_NAME];    

        //get userID from array usersIDList[row] = userID!
        NSNumber *usersID = [usersIDList objectAtIndex: [indexPath row]];
        [dbManager deleteUserWithID: [usersID intValue] table: @TABLE_USERS fieldName: @"UserID" ];

        [dbManager close];

        //Delete the object from the table.
        [self.tableView deleteRowsAtIndexPaths:
         [NSArray arrayWithObject: indexPath] 
        withRowAnimation: UITableViewRowAnimationFade];
    }
}

- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview delete-row

12
推荐指数
4
解决办法
3万
查看次数

UITableView EndUpdates在ios 8 beta中崩溃

我写了一段代码

[self.pItemArray insertObject:breakingItem  atIndex:0];
NSArray *array = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:0 inSection:0]];
[self.pTable beginUpdates];
[self.pTable insertRowsAtIndexPaths:array withRowAnimation:UITableViewRowAnimationNone];
[self.pTable endUpdates];
Run Code Online (Sandbox Code Playgroud)

但它只在endUpdtes上的ios 8中崩溃.

断言失败 - [UITableView _endCellAnimationsWithContext:],/ SourceCache/UIKit/UIKit-3302.3.1 /UITableView.m:1581

它在ios7或更低版​​本中工作正常.

请帮忙.

uitableview ios ios8

5
推荐指数
0
解决办法
668
查看次数

标签 统计

uitableview ×2

delete-row ×1

ios ×1

ios8 ×1

iphone ×1