我目前有一个应用程序将状态栏样式设置为浅色内容。
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
除了全屏模式窗口外,这可以正常工作。这是创建模态UIViewController的代码:
@implementation PostCard
- (id)initWithToRecipients:(NSArray *)toRecipients subject:(NSString *)subject message:(NSString *)message isHTML:(BOOL)isHTML
{
if ([MFMailComposeViewController canSendMail] && (self = [super init]))
{
self.viewController = [MFMailComposeViewController new];
self.viewController.mailComposeDelegate = self;
[_viewController setToRecipients:toRecipients];
[_viewController setSubject:subject];
[_viewController setMessageBody:message isHTML:isHTML];
self.viewController.modalPresentationStyle = UIModalPresentationFullScreen;
self.viewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
} else {
NSLog(@"Cannont send mail from current device.");
}
return self;
}
...
@end
明信片的视图控制器随后显示为
[myOtherViewController presentViewController:myPostCard.viewController animated:YES completion:nil];
在全屏模式下,statusBarStyle
会恢复为黑暗内容。如果我将modalPresentationStyle
更改为UIModalPresentationFormSheet
,则会保留指定内容。
有没有办法以编程方式设置模态窗口的'statusBarStyle`?或者告诉它继承呈现的UIViewController?或者这是一个错误? (注意,我也尝试过设置我的项目属性而没有成功。)
提前致谢!
答案 0 :(得分:-1)
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}