【问题标题】:StatusBarStyle for Full Screen UIViewController全屏 UIViewController 的 StatusBarStyle
【发布时间】:2014-04-03 17:32:29
【问题描述】:

我目前有一个将状态栏样式设置为浅色内容的应用程序。

[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 继承?或者这是一个错误? (注意,我也尝试过设置我的项目属性,但没有成功。)

提前致谢!

【问题讨论】:

    标签: ios7 fullscreen statusbar modalviewcontroller


    【解决方案1】:
    - (UIStatusBarStyle)preferredStatusBarStyle
    {
        return UIStatusBarStyleLightContent;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-04
      • 2014-10-03
      相关资源
      最近更新 更多