2014-03-02 64 views
0

我目前有一個應用程序將狀態欄樣式設置爲淺色內容。StatusBarStyle適用於全屏UIViewController

[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繼承?或者這是一個錯誤? (請注意,我也嘗試設置我的項目屬性,但沒有成功。)

在此先感謝!

回答

-1
- (UIStatusBarStyle)preferredStatusBarStyle 
{ 
    return UIStatusBarStyleLightContent; 
} 
相關問題