Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Chapter 4 Completion of Data Driven UI

HeroDetailController TableView content type setting

It's possible this is done later in the book...  Tried changing the TableView content type in the HeroDetailController Scene to "Dynamic Prototypes". Added the following TableViewDataSource methods to HeroDetailController.m:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return [self.sections count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)sectionIndex
{
    NSDictionary *section = [self.sections objectAtIndex:sectionIndex];
    NSArray * rows = [section objectForKey:@"rows"];
    return [rows count];
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)sectionIndex {
    NSDictionary *section = [self.sections objectAtIndex:sectionIndex];
    return [section objectForKey:@"header"];
}

Hero Detail Configuration

Added header entries to each of the sections, as shown originally in Figure 4-12. Everything still worked as prior. Very happy about that. Means I can edit the HeroDetailConfiguration.plist and get additional rows in the detail table without also monkeying around in the scene editor.

Really very happy about this data-driven UI feature. Sold me on the book.

Sign In or Register to comment.