In iOS5, using ARC and prototype cells for tableView on storyboard, can I replace the code below:
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
}
// Configure the cell...
return cell;
With this simple code??:
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:@"Cell"];
return cell;
I saw this on this link:
http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1
Thank's in advance!
Arildo
Sure, your code are right, storyboard automaticaly alloc new cells, this code work great:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
RoadbookCell *cell = (RoadbookCell *)[tableView dequeueReusableCellWithIdentifier:@"RoadbookCell"];
//Configure cell
//[cell.lab1 setText:@"Test"];
return cell;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With