Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Please do not create 21 different view controllers just to show different items. Instead set a property on <code>GlossaryDetailViewController</code> that holds an instance of your data model item.</p> <p>Consider this...</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSInteger row = [indexPath row]; if (self.glossaryDetailViewController == nil) { GlossaryDetailViewController *aGlossaryDetail = [[GlossaryDetailViewController alloc] initWithNibName:@"GlossaryDetailViewController" bundle:nil]; self.glossaryDetailViewController = aGlossaryDetail; [aGlossaryDetail release]; } glossaryDetailViewController.glossaryDetailItem = [glossaryArray objectAtIndex:row]; [self.navigationController pushViewController:self.glossaryDetailViewController animated:YES]; } </code></pre> <p>Using this approach makes <code>GlossaryDetailViewController</code> responsible for setting it's own data.</p> <p><strong>Edit</strong> You'll also notice that I removed references to the app delegate. You don't need it to get access to the navigation controller. Each view controller in a navigation controller stack has a reference to it. While I'm thoroughly tearing your code apart, I would also factor out the creation of the view controller by overriding the getter for <code>glossaryDetailViewController</code>, like this:</p> <pre><code>- (GlossaryDetailViewController *)glossaryDetailViewController { if (!glossaryDetailViewController) { glossaryDetailViewController = [[GlossaryDetailViewController alloc] init]; } return glossaryDetailViewController; } </code></pre> <p>If you go this route, you can remove the <code>if</code> statement and just call <code>self.glossaryDetailViewController</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload