0

この質問は以前から出てきましたが、受け入れられた解決策では私の問題を解決していないように見えます。違う。私は2番目のナビゲーションコントローラを提示しようとしています。ここでは背景が暗く、半透明でiPhoneアプリのため、ユーザーは以前のView Controllerの内容を見ることができます。ここでは、コードがあります:ナビゲーションコントローラーのビューコントローラーのコンテンツが表示されない

-(void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    RootViewController *rvc = [[UIStoryboard storyboardWithName:@"RootView" bundle:nil] instantiateViewControllerWithIdentifier:@"RootViewRVC"]; 
    self.nvc = [[UINavigationController alloc] initWithRootViewController:rvc]; 
    self.nvc.modalPresentationStyle = UIModalPresentationOverCurrentContext;  
    [self presentViewController:self.nvc animated:YES completion:nil]; 
} 

上記のコードは、これを得られます。

enter image description here

アプリは現在、ナビゲーションコントローラとrootviewcontrollerのためのストーリーボードを使用して、私が達成しようとしている内容が表示されます。

enter image description here

TableViewControllerは、rootvi ewcontroller(コードは両方の画像で同じストーリーボードを使用します)。ナビゲーションコントローラーのストーリーボードから、Xcode 8の属性インスペクターでは「プレゼンテーション」が「オーバーカレントコンテクスト」に設定されています(「オーバースクリーン」でも機能します)が、このトリックを行うように見えますが、ストーリーボードを使用してください。

+0

[モーダル提示のViewControllerのための透明な背景]の可能な重複(http://stackoverflow.com/questions/27669699/transparent-background-for-modally-presented-viewcontroller) – dmorrow

+0

ええ、私もその質問を見ましたが、何らかの理由で、受け入れられた解決策が私にとってうまくいかなかったのです。 – Vee

+0

definePresentationContextをYESに設定します。 http://stackoverflow.com/a/26891602/5184217 –

答えて

0

これは動作することができる:

-(void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    RootViewController *rvc = [[UIStoryboard storyboardWithName:@"RootView" bundle:nil] instantiateViewControllerWithIdentifier:@"RootViewRVC"]; 
    rvc.modalPresentationStyle = UIModalPresentationOverCurrentContext; 
    self.nvc = [[UINavigationController alloc] initWithRootViewController:rvc];  
    [self.nvc.view setBackgroundColor:[UIColor colorWithRed:1.0 green:0 blue:0 alpha:0.5]]; 
    [self presentViewController:self.nvc animated:YES completion:nil]; 
} 
関連する問題