Reputation: 91
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
int rows; // Return the number of rows in the section.
switch (section)
{
case 0:
rows = 1;
break;
case 1:
rows = 3;
break;
case 2:
rows = 2;
break;
case 3:
rows = 1;
break;
default:
rows = 1;
break;
}
return rows;
}
this code is running in infinite loop. for the first it returns right no of rows. but after that starts running on infinite loop. and one more thing, why section starts from the highest no and den come to 0 and den in ascending order??
Upvotes: 1
Views: 418
Reputation: 119242
There is no infinite loop in your code above. It's quite possible that it is being called from an infinite loop.
To find this, place a breakpoint in the method, continue a few times (to ensure you're in the loop rather than just the normal calls) and then look at the stack trace on the side. This should give you a pretty clear idea of where the looping is coming from. You are probably calling reloadData from within one of your datasource or delegate methods.
Upvotes: 2