mxb*_*mxb 6 objective-c uiviewcontroller ios
我有一个简单的控制器,显示另一个具有自定义转换的控制器.我用一个坚固的导航栏:
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
self.navigationController.navigationBar.barTintColor = [UIColor purpleColor];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
Run Code Online (Sandbox Code Playgroud)
这是第二个控制器:

当我MFMailComposeViewController在子控制器中打开一个状态栏时,状态栏是白色的白色(这也附加UIActivityViewController):

事实证明,这与设置modalPresentationStyle为UIModalPresentationCustom:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
UIViewController *controller = (UIViewController*)segue.destinationViewController;
// this line cause the bug
//controller.modalPresentationStyle = UIModalPresentationCustom;
controller.transitioningDelegate = self;
}
Run Code Online (Sandbox Code Playgroud)
如果controller.modalPresentationStyle保持不变,状态栏颜色是正确的.而且,这个属性似乎不会干扰自定义转换.
我在这里错过了一些东西?为什么会modalPresentationStyle影响系统控制器中的状态栏类型?这可能是个错误吗?
spa*_*sas 16
也许你可以尝试添加:
controller.modalPresentationCapturesStatusBarAppearance = YES
Run Code Online (Sandbox Code Playgroud)
设定后modalPresentationStyle.根据UIViewController类引用:
当您通过调用presentViewController:animated:completion:方法呈现视图控制器时,仅当呈现的控制器的modalPresentationStyle值为UIModalPresentationFullScreen时,状态栏外观控件才从呈现传送到呈现的视图控制器.通过将此属性设置为YES,即使呈现非全屏,也可以指定显示的视图控制器控件状态栏外观.