0

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?

iPhone
  • 4,092
  • 3
  • 34
  • 58
  • rest of the app shows status bar and only one controller is hiding it? – Saurabh Passolia Nov 20 '12 at 10:54
  • @samfisher:Yes,exactly right. Only this controller hides status bar. – iPhone Nov 20 '12 at 10:55
  • 1
    you need to check if there is any LOC in this controller where you have explicitly set statusbar as hidden `[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];` and set it to `setStatusBarHidden:NO` in your code – Saurabh Passolia Nov 20 '12 at 10:58

4 Answers4

0

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

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
  • thanx for reply friend but then what is the solution? because this problem affects my other viewcontroller – iPhone Nov 20 '12 at 11:03
  • no cocoa way .. dont know enough html to tell you more or IF that event works - sorry – Daij-Djan Nov 20 '12 at 11:05
  • one idea would be to keep the webview from playing movies (you could return NO from shouldStartLoading) THEN play it in your own view controller – Daij-Djan Nov 20 '12 at 11:06
0

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

}
Paras Joshi
  • 20,427
  • 11
  • 57
  • 70
0

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.

Kamar Shad
  • 6,089
  • 1
  • 29
  • 56
  • 1
    that looks good but it uses undocumented behaviour and could break at some point – Daij-Djan Nov 20 '12 at 11:10
  • @Daij-Djan Yeah you are right.But I have used the same Code avoiding the same problem .Now My application uses the same Code is on AppStore...without any rejection – Kamar Shad Nov 20 '12 at 11:10
  • yes, Im saying: it IS a cool&reasonable way but in THEORY unsafe. Just ushering a word of warning :D – Daij-Djan Nov 20 '12 at 11:15
0

Another Way:

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

- (void)VideoFullScreenExit:(id)sender {
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
}
Ganpat
  • 768
  • 3
  • 15
  • 30