2011-07-08 10 views
3

ランドスケープモードでUINavigationViewControllerを表示する際に問題があります。ビューは自動的にポートレートモードになります。私はすでに3時間かけてこの問題を解決しました。私はナビゲーションコントローラなしで表示するとうまくいきます。しかし、私はそれから別のviewcontrollerをプッシュする必要があるので、私はナビゲーションコントローラが必要です。IPad UINavigationControllerランドスケープ問題

問題を解決するために何か提案してください。ここにコードがあります。あなたがこれを行う場合は

SharingViewController *sharingViewController = [[SharingViewController alloc] initWithNibName:@"SharingViewController" bundle:nil]; 

    UINavigationController *navi = [[[UINavigationController alloc] initWithRootViewController:sharingViewController] autorelease]; 

    [navi setWantsFullScreenLayout:YES]; 
    [navi.view setAutoresizesSubviews:NO]; 
    [navi.navigationBar setHidden:YES]; 
    navi.view.autoresizingMask = UIViewAutoresizingFlexibleWidth; 
    navi.visibleViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth; 

    self.modalPresentationStyle = UIModalPresentationCurrentContext; 
    [self presentModalViewController:navi animated:YES]; 

答えて

1

SharingViewController *sharingViewController = [[SharingViewController alloc] initWithNibName:@"SharingViewController" bundle:nil]; 
sharingViewController.modalPresentationStyle = UIModalPresentationCurrentContext; 

UINavigationController *navi = [[[UINavigationController alloc] initWithRootViewController:sharingViewController] autorelease]; 
navi.modalPresentationStyle = UIModalPresentationCurrentContext; 
... 

[[self navigationController] presentModalViewController:navi animated:YES]; 

それが動作するはずです。私は同じ問題を抱えていましたが、modalPresentationStyleというプロパティをviewControllerとUINavigationControllerに追加すると、それは動作し始めました。

+0

私はそれを試みます。私の周りの仕事は、私が手動でナビゲーションコントローラのフレームを変更したことでした。 –