I am displaying an UITableView which can contain many rows (over 100).  

Set up is straightforward, in viewDidLoad of the viewController I set up the 
datasource from the CoreData stack into an NSArray called myItems.


The delegate methods are also standard:

- (NSInteger)tableView:(UITableView *)tableView 
numberOfRowsInSection:(NSInteger)section
{
    return [myItems count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView 
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: 
@"MyCell"];
    
    if (!cell)
    {
        cell = [[UITableViewCell alloc] initWithStyle: 
UITableViewCellStyleSubtitle reuseIdentifier: @"MyCell"];
    }

    Item *myItem = [self.myItems objectAtIndex: [indexPath row]];
            
   [[cell textLabel] setText: myItem.name];
   [[cell detailTextLabel] setText: myItem.title];
    
    return cell;
}

Occasionally, the app crashes when scrolling/swiping to the last item in the 
tableview:

Terminating app due to uncaught exception 'NSRangeException', reason: '*** 
-[__NSArrayI objectAtIndex:]: index 104 beyond bounds [0 .. 103]'. 

I understand what this means, but am puzzled how it can happen, since I am not 
modifying the datasource once the view is shown.

Am I overlooking something here?

Thanks,

- Koen.






_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to