16
UIViewControllerの上にclearColor UIViewControllerを表示します
私はUIViewControllerのようにビューをサブビュー/モーダル別の上UIViewController図は、そのようなものとサブビュー/モーダル透明であるべきであり、どのコンポーネントが見えるはずサブビューに追加されます。問題は、サブビューがclearColorを持つ代わりに黒の背景を表示することです。私はUIView黒の背景ではなくclearColor として作ろうとしています。誰かがそれの何が悪いのか知っていますか?どんな提案も歓迎します。 FirstViewController.m UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"SecondViewController"]; [vc setModalPresentationStyle:UIModalPresentationFullScreen]; [self presentModalViewController:vc animated:NO]; SecondViewController.m - (void)viewDidLoad { [super viewDidLoad]; self.view.opaque = YES; self.view.backgroundColor = [UIColor clearColor]; } 解決済み:問題を修正しました。iPhoneとiPadの両方でうまく機能しています。黒い背景のないモーダルビューコントローラーは、clearColor / transparentです。変更する必要があるのは、に置き換えるUIModalPresentationFullScreenことだけUIModalPresentationCurrentContextです。とても簡単です。 FirstViewController.m UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"SecondViewController"]; vc.view.backgroundColor = …