Universal Master-Detail Storyboard help on segue

Go To StackoverFlow.com

0

I am trying to make my first Universal app using iPhone and iPad storyboards.

I have a very simple app that show a list on the UITable and the detail of the item when clicked.

It works fine for iPhone, I created a segue to push the detail view ans its working fine with this code:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [self performSegueWithIdentifier:@"detail" sender:nil];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"detail"])
    {
        NSIndexPath *selectedIndex = [self.tableView indexPathForSelectedRow];
        // Get reference to the destination view controller
        self.detailViewController = [segue destinationViewController];

        // Pass any objects to the view controller here, like...
        self.detailViewController.detailDict = [myArray objectAtIndex:selectedIndex.row];
    }
}

I dont know if that make any difference but I have set up my iPad to work only on landscape. Anyway, how can I optimize this code to work on the iPad story board too?

I have already tried different segues for iPad but none of them worked. I get (gdb)

2012-04-04 18:54
by André Cytryn


0

I ended up with this code. It's working for iOS 5 and 6

#pragma mark - Orientations

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
        return UIInterfaceOrientationIsPortrait(interfaceOrientation);
    else
        return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

And to be sure I checked the buttons on the Target > Summary > Supported Interface Orientations

2013-01-22 16:14
by André Cytryn
Ads