In fact, the status bar is translucent.
- (void)webViewDidFinishLoad:(UIWebView *)theWebView { // only valid if StatusBarTtranslucent.plist specifies a protocol to handle if(self.invokeString) { // this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString]; [theWebView stringByEvaluatingJavaScriptFromString:jsString]; } [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent; CGRect frame = theWebView.frame; NSLog(@"The WebView: %f %f %f %f", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); frame = theWebView.superview.frame; NSLog(@"The WebView superview: %f %f %f %f", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); frame.size.height += frame.origin.y; frame.origin.y = 0; [theWebView.superview setFrame:frame]; return [ super webViewDidFinishLoad:theWebView ]; }
The result of this code shows:
The WebView: 0.000000 0.000000 320.000000 460.000000 The WebView superview: 0.000000 20.000000 320.000000 460.000000
so fixing the webview.superview framework you can get the effect of UIStatusBarTranslucent
CGRect frame = theWebView.superview.frame; frame.size.height += frame.origin.y; frame.origin.y = 0; [theWebView.superview setFrame:frame];
source share