O'Reilly Forums: Chapter 4 W/ Xcode 4.4 - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Chapter 4 W/ Xcode 4.4 Confused about the NSDate reference when you set cell text

#1 User is offline   MBguitarburst 

  • New Member
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 23-August 10

Posted 07 August 2012 - 10:57 PM

I'm working through chapter 4 and I am using Xcode 4.4, which seems to have a number of differences from when the 2nd Ed. was written. In the section of the RootViewController.m (actually MasterViewController under the Master App template) there is a specific line in the cellForRowAtIndexPath section that I'd like some help understanding. What is this code suppose to do: NSDate *object = [_objects objectAtIndex:indexPath.row];?

*note that I commented out the Xcode prebuilt code and replaced it with the book code and the App seems to work as it should up till this point. Just wondering what I'm missing by excluding this line.

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
   
    cell.textLabel.text = [self.drinks objectAtIndex:indexPath.row];
    return cell;

    /*NSDate *object = [_objects objectAtIndex:indexPath.row];
    cell.textLabel.text = [object description];
    return cell;*/
}

This post has been edited by MBguitarburst: 07 August 2012 - 10:58 PM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users