2013-10-10 55 views
9

我不是唯一遇到此類問題的人。這是另一個,Status bar height changes after playing a Youtube video。但我仍然無法找到解決這個問題的方法。我沒有使用MPMoviePlayerController。我想我只需要使用這些代碼;iOS 7狀態欄在播放視頻後消失

[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO]; 

self.webView.frame = CGRectMake(0.0, 
           20.0, 
           self.webView.frame.size.width, 
           self.webView.frame.size.height); 

但它沒有那麼奏效。

請參考下面這個圖片..

enter image description here

起初,這是我的 「家」 的模樣。而從Youtube/Vimeo的(或其他)播放視頻

enter image description here

狀態欄消失。

enter image description here

當我回去,看到他們聚成一團。

enter image description here

發現,FB計算出如何處理這個問題。他們的狀態欄顯示在那裏。

任何幫助?

提前歡呼!

+0

我有同樣的問題。你有沒有找到解決方案? – user2955351

回答

1

我不知道是否適用於你的情況,但在我的情況下,狀態欄出現後我加載了UIImagePickerController並更改我的默認屏幕方向。

我修正了這種情況add application.statusBarHidden = YES;內的appDelegate這樣的:

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { 
// Detect if I need to hide the StatusBar (optional) 
if (iNeedToHide == YES) { 
    application.statusBarHidden = YES; 
} 
return UIInterfaceOrientationMaskLandscape; 

}

我希望這可以幫助你。

+0

抱歉,我需要在播放視頻時顯示狀態欄,以防止其他屏幕的導航欄與狀態欄聚攏在一起。我在打開Youtube/Vimeo網站時顯示它,但是當我播放Vid時,它會消失.. – caribbean

+0

我不知道您的視頻控件是否是一種導航控制器,但是如果是這樣,您可以使用此代理程序並隱藏狀態欄://使用狀態欄狀態欄下載UIImagePicker - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {// Esconder el StatusBar。挑戰共享應用程序] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; [UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; } – Beto

1

我不得不在關閉視頻播放器時禁用動畫。將視頻的通知去把事件:

[[NSNotificationCenter defaultCenter] addObserver:self 
              selector:@selector(videoDidFinish:) 
               name:MPMoviePlayerPlaybackDidFinishNotification 
               object:controller.moviePlayer]; 

然後,方法裏面,駁回視圖控制器無動畫:

- (void)videoDidFinish:(NSNotification *)notification { 
    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification 
                object:controller.moviePlayer]; 
    [self dismissViewControllerAnimated:NO completion:nil]; 
}