Pregunta

Below is happening with iOS 6.

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.

When I play video as potrait only, I still see black status bar as shown below.

enter image description here

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).

enter image description here

Also if you see, I see something black left to the time.

Any idea what is going wrong? This is literally making me crazy.


Edit 1

Below is the code I am using.

In viewcontroller.m

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

- (BOOL)shouldAutorotate
{
    return NO;
}

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];
    }
}

Note:

I am not using below code anymore.

[[UIDevice currentDevice] performSelector:NSSelectorFromString(@"setOrientation:") withObject:(id)UIInterfaceOrientationPortrait];

still this problem persist...

The problem is when I am in landscape mode and click done button.

¿Fue útil?

Solución

It's weird...

After further investigation, I noticed that when video is played in landscape mode, status bar is changed to transculent.

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];
    }
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top