2012-04-04 8 views
0

iPhoneとiPadのストーリーボードを使用して初めてユニバーサルアプリを製作しようとしています。Universal Master-Detail Storyboard help on segue

私は、UITableのリストとクリックしたときのアイテムの詳細を表示する非常にシンプルなアプリケーションを持っています。

それはiPhoneのために正常に動作し、私は詳細ビューをプッシュするセグエを作成し、ANSのこのコードで細かい作業:

- (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]; 
    } 
} 

私はそれがすべての違いを作る場合は知らないが、私が私のiPadを設定していますランドスケープでのみ動作します。 とにかく、iPadストーリーボードでもこのコードを最適化するにはどうすればよいですか?

私はすでにiPad用に異なるセグを試しましたが、どれもうまくいきませんでした。私は得る(gdb)

答えて

0

私はこのコードで終わった。これは、iOS 5および6

#pragma mark - Orientations 

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

のために働いていると私は、ターゲット上のボタンをチェックしてくださいする>概要>サポートされているインターフェイスの向き

関連する問題