Help with navigation-based app?

Discussion in 'iOS Programming' started by Toastinator, Jun 21, 2014.

  1. Toastinator macrumors newbie

    Joined:
    Aug 20, 2011
    #1
  2. Ubuntu macrumors 68000

    Ubuntu

    Joined:
    Jul 3, 2005
    Location:
    UK/US
    #2
    Please post a code sample in order to help us help you. Based on the current information I can only guess that something's gone wrong in your prepareForSegue method. First of all, have you set the segue's identifier to be "ShowCardDetails"? This is done in the storyboard itself and explained in the first paragraph of the "Establishing the Storyboard Segue" section in that tutorial.

    If you haven't done so then the prepareForSegue method (below) will not execute the code within the if statement, meaning that the detail view controller will not get the information it requires.

    Code:
    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
    [B]    if ([[segue identifier] isEqualToString:@"ShowCarDetails"])
    [/B]    {
            CarDetailViewController *detailViewController =
               [segue destinationViewController];
    
            NSIndexPath *myIndexPath = [self.tableView
               indexPathForSelectedRow];
    
            long row = [myIndexPath row];
    
            detailViewController.carDetailModel = @[_carMakes[row],
            _carModels[row], _carImages[row]];
        }
    }
    
     
  3. Toastinator thread starter macrumors newbie

    Joined:
    Aug 20, 2011
    #3
    Thanks a lot! Very simple fix: I was missing a letter in the identifier. Ha, ha... Sorry, I can't believe I missed that.
     
  4. Ubuntu macrumors 68000

    Ubuntu

    Joined:
    Jul 3, 2005
    Location:
    UK/US
    #4
    No worries, I only knew that because I've been there before :p
     

Share This Page