CHAPTER 5 ANSWERS

 
  1. The UITableViewDataSource tells the table how many sections and rows are in the table, and what the section headers and indexes are, along with configuring the UITableViewCells. The UITableViewDelegate manages the editing of the UITableView.
  2. Basic, Right Detail, Left Detail, and Subtitle.
  3. To modify the UITableViewCell to a right detail style and show the band rating as the detailTextLabel:
    1. Open the Main.storyboard.
    2. Select the prototype cell and change its style to Right Detail.
    3. Open the WBABandsListTableViewController.m file and modify the tableView:cellForRowAtIndexPath: with the following code:
      - (UITableViewCell *)tableView:(UITableView *)tableView
      cellForRowAtIndexPath:(NSIndexPath *)indexPath
      {
          static NSString *CellIdentifier = @"Cell";
          UITableViewCell *cell = [tableView
      dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
         
          NSString *firstLetter = [self.firstLettersArray
      objectAtIndex:indexPath.section];
          NSMutableArray *bandsForLetter = [self.bandsDictionary
      objectForKey:firstLetter];
          WBABand *bandObject = [bandsForLetter objectAtIndex:indexPath.row];
         
          // Configure the cell...
          cell.textLabel.text = bandObject.name;
         
      cell.detailTextLabel.text = [NSString stringWithFormat:@"%d",
      bandObject.rating];

         
          return cell;
      }
  4. You can show a UIViewController that animates up from the bottom on the screen using the presentViewController:animated:completion:method.
  5. The UIKit item added to the top of a view when using a UINavigationController is the UINavigationItem.
  6. The push segue is used to transition between the Bands List scene and the Band Details scene.