문제

I am trying to remove all the objects from the NSMutableArray and I am reloading the UITableView. But it produces SIGABRT in cellForRowAtIndexPath. The code is given below.

if ([nsMutableArray count] != 0) {

        [nsMutableArray removeAllObjects];
        [tableView reloadData];
    }

It shows SIGABRT in

if (cell == nil) {

        cell = (UICustomCell *)[nsMutableArray objectAtIndex:indexPath.row];
    }

Help me to come out of this problem.

도움이 되었습니까?

해결책

change this

to

if ([NSMutableArrayObject count] != 0) {
   [NSMutableArrayObject removeAllObjects];
   [tableView reloadData];
}

if (cell == nil) {
    cell = (UICustomCell *)[NSMutableArrayObject objectAtIndex:indexPath.row];
}

다른 팁

You are calling instance methods (count, removeAllObjects, reloadData, objectAtIndex:) on classes (NSMutableArray, UITableView) instead of object instances.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top