This is all we need to do now when grabbing a cell for display in a UITableViewController in iOS6:
– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @”carTableCell”;
CarTableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier
forIndexPath:indexPath];
// Configure the cell here …
return cell;
}
[/sourecode]
We used to have to do this (but not anymore – iOS6 now takes care of this for us)
// This step no longer required in iOS 6
if (cell == nil) {
cell = [[CarTableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
}
[/sourecode]
Note: You still need the above code if you are working with customer xibs and cells.
Links that help:
http://www.techotopia.com/index.php/An_Overview_of_iOS_6_Table_Views_and_Xcode_Storyboards
Nov 17, 2012 @ 00:31:34
But what if we want to use a different style than UITableViewCellStyleDefault? No we don’t alloc and init the cell ourselves, and I can’t figure out where to change the style! Any tips?
Sep 12, 2013 @ 09:49:00
What’s the benefit of supplying indexpath dequeue method as it seems to work like same
May 07, 2014 @ 17:30:12
Why do you say that dequeueReusableCellWithIdentifier is no longer needed in the title then proceed to show code that uses dequeueReusableCellWithIdentifier?