Pregunta

I am opening video in UIWebView with following code.

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    NSLog(@"Navigatin Type %d %@",navigationType, request);
    if (navigationType == 0) {
        self.navigationItem.leftBarButtonItem = backBarBtn;
        [self showVideoInWebView:[request.URL absoluteString]];
        return NO;
    }

    return YES;
}

-(void)showVideoInWebView:(NSString *)urlStr
{
    [mainWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
}

but when my mainWebView opens in full screen it hides my status bar.

I don't want to hide status bar

then how can I show my status bar?

¿Fue útil?

Solución

You Can set Notification For making Status bar Visible. Set The Notification for FullScreen Entry And Exit Notification ,SO that you could SHow And Hide The Status bar As Needed.

// For FullSCreen Entry 

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoFullScreen:) name:@"UIMoviePlayerControllerDidEnterFullscreenNotification" object:nil];

// For FullSCreen Exit
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoExitFullScreen:) name:@"UIMoviePlayerControllerDidExitFullscreenNotification" object:nil];


- (void)videoFullScreen:(id)sender
   {
     [[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];

   }

- (void)videoExitFullScreen:(id)sender
 {
  //Here do WHat You want
 }

I am Sure It'll be helpful to you.

Otros consejos

that is the behaviour of the built-in movie player AFAIK you cant change it ... maybe with an alternative HTML5 control.

when your UIWebView begin Fullscreen at that time write this line..

just try with this line..

-(void)moviePlayerEvent:(NSNotification*)aNotification{

     [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];
     NSLog(@"%i", [UIApplication sharedApplication].statusBarHidden);

}

Another Way:

[[NSNotificationCenter defaultCenter] addObserver:self                                             
selector:@selector(VideoFullScreenExit:) name:UIWindowDidBecomeHiddenNotification object:self.view.window];

- (void)VideoFullScreenExit:(id)sender {
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top