在横向模式下关闭视频后状态栏变为渐变 [英] status bar becomes gradient after closing video in landscape mode
问题描述
iOS 6正在发生以下情况。
Below is happening with iOS 6.
我正在播放可以在potrait或横向模式下播放的视频。按下视频的完成按钮后,我将以编程方式将屏幕设置为potrait模式。
I am playing video which can be played in potrait or landscape mode. Once video's Done button is pressed I am making screen to potrait mode programmatically.
问题是当我打开应用程序时,我有黑色状态栏。
The problem is when I open app, I have black status bar.
当我只播放视频作为potrait时,我仍然会看到如下所示的黑色状态栏。
When I play video as potrait only, I still see black status bar as shown below.
现在我播放视频并在播放完毕后转换旋转然后单击完成按钮,我在potrait模式下制作应用程序。 但现在我的状态栏变为浅黑色(可能是BlackTransculent)。
Now when I play video and shift rotation after after playback is done and click Done button, I make app in potrait mode. BUT now my status bar is changed to light black (maybe BlackTransculent).
如果你看到,我看到一些黑色留给了时间 即可。
Also if you see, I see something black left to the time.
知道出了什么问题吗?这实际上让我发疯。
以下是我正在使用的代码。
Below is the code I am using.
在viewcontroller.m中
In viewcontroller.m
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
- (BOOL)shouldAutorotate
{
return NO;
}
在CustomNavigation.m
In CustomNavigation.m
- (BOOL)shouldAutorotate
{
return [self.visibleViewController shouldAutorotate];
}
- (NSUInteger)supportedInterfaceOrientations
{
if (![[self.viewControllers lastObject] isKindOfClass:NSClassFromString(@"ViewController")])
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
else
{
return [self.topViewController supportedInterfaceOrientations];
}
}
注意:
我不再使用下面的代码。
I am not using below code anymore.
[[UIDevice currentDevice] performSelector:NSSelectorFromString(@"setOrientation:") withObject:(id)UIInterfaceOrientationPortrait];
此问题仍然存在......
still this problem persist...
推荐答案
这很奇怪......
It's weird...
经过进一步调查后,我注意到当以横向模式播放视频时,状态栏会变为透明状态。
After further investigation, I noticed that when video is played in landscape mode, status bar is changed to transculent.
我尝试了什么以编程方式完成视频完成播放后,将状态栏设置回黑色 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
,但是这也不起作用。
What I tried programmatically is after video is done with playing, set status bar back to black [[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackOpaque];
, BUT that was not also working.
所以我所做的就是当用户点回按钮时,我将其设置为黑色并且它正在工作。不确定是什么问题。
So what I did is when user hit back button, I set it to black and there it was working. Not sure what is the problem.
- (IBAction)takeMeBackAction:(id)sender {
// [self takeMeDownAction:nil];
if (IS_DEVICE_RUNNING_IOS_6_OR_BELOW()) {
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackOpaque];
}
}
这篇关于在横向模式下关闭视频后状态栏变为渐变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!