I have receive a EXC Bad Access error when I enter the if statement below [tableView numberOfRowsInSection:0]
.I'm calculating the tableView numberOfRowsInSection
of the UITableView inside the heightForRowAtIndexPath .
I have got following code to set height for last row of first section
-(CGFloat )tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section==0) {
NSInteger lastRowIndex = [tableView numberOfRowsInSection:0] - 1;
if (indexPath.row==lastRowIndex) {
return 44.0f;
}else{
return 100;
}
}else{
return 100;
}
}
I got the error as below image
I didnt find this method appropriate
iOS UITableView numberOfRowsInSection BAD ACCESS
- (int) myNumberOfRowsMethod{
// Here you would usually have some underlying model
return [self.myContactsOrWhateverArray count];
}