I have written this method in objectiveC (for iOS but that immaterial). My app crashes when calling this method. I am writing all this in my .m file. Am not able to figure out the reason for the crash…
-(UITableViewCell *)myCell:(UITableViewCell *)cell
forRowIndex:(NSIndexPath *)indexPath
{
//customize the cell.
return cell;
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellId = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellId];
if(cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ResultsOne" owner:self options:nil];
cell = self.resultsOne;
}
cell = [self myCell:cell:indexPath]; //code crashes here
return cell;
}
What am i doing wrong ?
You need to write the method call like this:
cell = [self myCell:cell forRowIndex:indexPath];