views:

478

answers:

1

SendDelegateMessage: delegate failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode If you were not using the touch screen for this entire interval (which can prolong this wait), please file a bug.

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath  { 
    /*
    //NSString *label = [self.aNote length] == 0 ? kDefaultNoteLabel : self.aNote;
    NSString *label = [countriesToLiveInArray objectAtIndex:indexPath.row];

    //CGFloat height = [label RAD_textHeightForSystemFontOfSize:kTextViewFontSize] + 20.0;
    //return height;
    float lineHeight = [ @"Fake line" sizeWithFont: [UIFont fontWithName:@"MarkerFelt-Thin" size:15] ].height;


    int numLines = [label sizeWithFont: [UIFont fontWithName:@"MarkerFelt-Thin" size:15]  constrainedToSize: CGSizeMake(250, lineHeight*1000.0f) lineBreakMode: UILineBreakModeTailTruncation ].height / lineHeight;
    CGSize labelsize =  CGSizeMake(250, (lineHeight*(float)numLines));
    return labelsize.height+10;
     */
    return 100;

}

this delegate is the prob.if i comment out this whole function then program works. ad table view use default height but is we return any kind of return value then it shows the message...please help us.

A: 

Using -heightForRowAtIndexPath: is very expensive for tables with a large number of rows. It has to be called once for every row in the table, not just the visible rows. Apple warns about it in the documentation:

There are performance implications to using tableView:heightForRowAtIndexPath: instead of the rowHeight property. Every time a table view is displayed, it calls tableView:heightForRowAtIndexPath: on the delegate for each of its rows, which can result in a significant performance problem with table views having a large number of rows (approximately 1000 or more).

Unless you can cache some information to make the method run more quickly, you should probably consider using a fixed row height.

Mark Smith