开发者

How to speed up table row scroll?

i have a table row maded by these elements:

How to speed up table row scroll?

1 - image view (the calendar)

4 - uilabel (month, day, title, description)

on cellForRowAtIndexPath i fill labels in this way (the image is the same and is inserted by interface builder):

@try {
    newsRow = ((NewsRowController *)[tableView dequeueReusableCellWithIdentifier:@"cell"]);
    if (newsRow == nil) {
        if (IS_IPAD)
            [[NSBundle mainBundle] loadNibNamed:@"NewsRow_ipad" owner:self options:nil];
        else [[NSBundle mainBundle] loadNibNamed:@"NewsRow" owner:self options:nil];

        if ([tableArray count] > 0) {
            [newsRow setCellDataWithName:[tableArray objectAtIndex:indexPath.row]  
                                 andDate:[descArray objectAtIndex:indexPath.row] 
                                     day:[dayArray objectAtIndex:indexPath.row]
                                   month:[monthArray objectAtIndex:indexPath.row]];
        }
    }       
}
@catch (NSException * e) {
    NSLog(@"fail.");
}
return newsRow;

Now, tableArray, descArray, dayArray, monthArray are NSMutableArray populated on viewDidLoad.

Why on iPhone device (my test is with 3G) is too slow to scroll up/down?

What i need to remove to speed up table?

This is all of my code, but i don't able to find a better solution...

EDIT:

How to speed up table row scroll?

I don't able to set identifier... i don't see it...

and my News Row Controller is an:

@interface NewsRowController : UITableVie开发者_开发知识库wCell

Any idea from the world of iphonist??? :)

thanks,

A


is the reuseidentifier of your tableviewcell in the nib file correct? (you can find it in the attribute inspector)

I doubt it, because if it would be "cell" you would ask why your cells don't update.


Edit: Check again in interface builder if the identifier is exactly the same as in your code.

How to speed up table row scroll?

and then change your code like this:

if (newsRow == nil) {
    if (IS_IPAD)
        [[NSBundle mainBundle] loadNibNamed:@"NewsRow_ipad" owner:self options:nil];
    else 
        [[NSBundle mainBundle] loadNibNamed:@"NewsRow" owner:self options:nil];
}
else {
    NSLog(@"Dequeue success");
}
// no matter if there was a successful dequeue or not, you have a valid cell at this point
if ([tableArray count] > 0) {
    [newsRow setCellDataWithName:[tableArray objectAtIndex:indexPath.row]  
                         andDate:[descArray objectAtIndex:indexPath.row] 
                             day:[dayArray objectAtIndex:indexPath.row]
                           month:[monthArray objectAtIndex:indexPath.row]];
}

see if you can see the Dequeue success logmessage


EDIT2

are you sure you have added a Table View Cell and not a UIView to your Nib?
I've never tried but for me it sounds possible that you can have an UIView in a nib which gets "promoted" to an TableViewCell which is added to an tableview.

My best attempt to check for this is the icon of the cell It should look like this:

How to speed up table row scroll?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜