我有一个简单的控制器,显示具有自定义转换的另一个控制器。我用了坚实的导航栏:将modalPresentationStyle设置为自定义会在MFMailComposeViewController中导致错误的状态栏颜色
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
self.navigationController.navigationBar.barTintColor = [UIColor purpleColor];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
这是第二个控制器:
当我在孩子控制器打开MFMailComposeViewController
,状态栏是白的白色(这也appens与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;
}
如果controller.modalPresentationStyle
保持不变,则状态栏颜色正确。而且,这个属性似乎不会干涉自定义转换。
我在这里失去了一些东西?为什么modalPresentationStyle
影响系统控制器中的状态栏类型?这可能是一个错误?
全部代码是在这里https://github.com/mbigatti/StatusBarTest
我试过你的建议,它确实有效。我不清楚的是,如果controller.modalPresentationStyle = UIModalPresentationCustom是否需要用于自定义转换,因为似乎忽略该行会产生相同的结果。 – mxb
AFAIK如果您想要自定义转换,您必须使用UIModalPresentationCustom,但我还没有广泛测试过... – spassas
使用UIModalPresentationCustom指定视图控制器的视图如何在转换前后处理,并且只有在自定义转换需要父视图控制器的视图留在屏幕上。当转换(使用自定义或默认转换)到使用整个屏幕的视图控制器(默认行为)时,您不需要指定它。 – Split