Hello, all ...

I'm trying to determine why my tableviews scroll so jerkily on non-3GS devices. 
The datasource only has perhaps 170 records, so I think it may have something 
to do with how i'm instantiating the cells in -tableView:cellForRowAtIndexPath. 
In other apps i've done, I create the view for the cell programmatically, and 
alloc / init the cell if I can't dequeue it. However, in this app, I have the 
cell's view loaded from a XIB. Is there a better way of defining my cell's view 
with IB that still results in a performant tableview?

- (UITableViewCell *)tableView:(UITableView *)tableViewIn 
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
       static NSString *cellID = @"mycellID";

        MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication 
sharedApplication] delegate];

        LogDailyCell *cell = (LogDailyCell *)[tableViewIn 
dequeueReusableCellWithIdentifier:cellID];

       if (nil == cell)
       {
                NSArray *nib = [[NSBundle mainBundle] 
loadNibNamed:@"LogDailyCell"
                                                                                
                         owner:self options:nil];
                for (id oneObject in nib)
                {
                        if ([oneObject isKindOfClass:[LogDailyCell class]])
                        {
                                cell = (LogDailyCell *)oneObject;
                                break;
                        }
                }
       }

        MyObject *act = nil;
        
        switch(indexPath.section)
        {
                case 0:
                        act = [appDelegate array1ItemAtIndex:indexPath.row];
                        cell.type = 2;
                        break;
                case 1:
                        act = [appDelegate array2ItemAtIndex:indexPath.row];
                        cell.type = 3;
                        break;
                case 2:
                        act = [appDelegate array3ItemAtIndex:indexPath.row];
                        cell.type = 4;
                        break;
                case 3:
                        act = [appDelegate array4ItemAtIndex:indexPath.row];
                        cell.type = 5;
                        break;
        }

        cell.name.text = act.name;
        cell.label1.text = [NSString stringWithFormat:@"%i", act.anNSString];
        cell.field1.text = @"";
        cell.field2.text = @"";
        cell.ident = indexPath.row;
        [cell.deleteButton removeFromSuperview];
        
       return cell;
}

Regards,

John
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to