views:

159

answers:

0

My apologies for posting such a book-specific question but by question relates to a particular explanation, which some of the members here may have come across, in "Beginning iPhone 3 Development: Exploring the iPhone SDK by Dave Mark and Jeff LaMarche". I have tried the book's forum some time ago with no response.

I am slightly confused by the paragraph describing the "one other change" on page 300 of the book.

The above-mentioned paragraph details the reasoning behind NOT allowing the reuse of a child controller in the didSelectRowAtIndexPath method of PresidentsViewController.

I am unsure:

1) Why a nib with outlets would have would make the process of reuse of the child controller "easy"?

2) Why does using a table view, for the detail view, make the reuse of the child controller more complicated?

3) The author mentions that "When you're using a table view to implement your detail view, the methods that fire the first time and the ones that fire subsequent times are different." but no explanation is given as to how they are different.

I can only apologise if these questions are elementary but any detailed answer would be gladly received. It has been a great book but I found this particular section very confusing.

The code that the paragraph in question refers to is:

- (void)tableView:(UITableView *)tableView 
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    NSUInteger row = [indexPath row];
    President *prez = [self.list objectAtIndex:row];

    PresidentDetailController *childController = 
    [[PresidentDetailController alloc] 
     initWithStyle:UITableViewStyleGrouped];

    childController.title = prez.name;
    childController.president = prez;

    [self.navigationController pushViewController:childController animated:YES];
    [childController release];
}