Hello,

I'm new to this list and also relatively new to development on the Mac/iPhone 
platforms.

I was just wondering if someone could clarify how exactly 
dequeueReusableCellWithIdentifier: works. The reason I ask is because I have 
the following code:

---------

- (UITableViewCell *)tableView:(UITableView *)tableView 
cellForRowAtIndexPath:(NSIndexPath *)indexPath {

        UITableViewCell *cell = [channelList 
dequeueReusableCellWithIdentifier:@"channelCell"];
        
        if (cell == nil) {
                cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero 
reuseIdentifier:@"channelCell"] autorelease];
        }
        
        [[cell textLabel] setText:[channels objectAtIndex:[indexPath row]]];
        
        return cell;
}

---------

Now if I set a break point inside the if statement I was expecting that it 
would only be entered once, however it is entered every time a cell is created. 
 Shouldn't the call to dequeueReusableCellWithIdentifier: return a cell after 
it has been created inside the if statement?  Or am I misunderstanding how this 
works?

Regards,

JD_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to