如何在iOS半透明中制作PhoneGap状态栏?

如何在iOS半透明中制作PhoneGap状态栏?,第1张

概述我正在使用PhoneGap来构建iOS应用程序,似乎无法使全屏/半透明状态栏效果起作用. 我将* -info.plist的状态栏样式设置为透明黑色样式(alpha为0.5),在启动画面启动时可以正常工作.但是,当显示PhoneGap的UIWebView时,状态栏会变黑. 我尝试在我的index.html中将apple-mobile-web-app-status-bar风格的元标记设置为黑色半透明, 我正在使用PhoneGap来构建iOS应用程序,似乎无法使全屏/半透明状态栏效果起作用.

我将* -info.pList的状态栏样式设置为透明黑色样式(Alpha为0.5),在启动画面启动时可以正常工作.但是,当显示PhoneGap的UIWebVIEw时,状态栏会变黑.

我尝试在我的index.HTML中将apple-mobile-web-app-status-bar风格的元标记设置为黑色半透明,但这似乎没有任何效果.

我尝试将phonegap.pList的topStatusbar选项设置为blackTranslucent,但这也没有任何效果.我错过了什么?

解决方法 实际上状态栏是半透明的.

- (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.size.height);    frame.size.height += frame.origin.y;    frame.origin.y = 0;    [theWebVIEw.supervIEw setFrame:frame];    return [ super webVIEwDIDFinishLoad:theWebVIEw ];}

此代码的日志结果显示:

The WebVIEw: 0.000000 0.000000 320.000000 460.000000The WebVIEw supervIEw: 0.000000 20.000000 320.000000 460.000000

所以修复webvIEw.supervIEw框架可以获得UIStatusbarTranslucent的效果

CGRect frame = theWebVIEw.supervIEw.frame;frame.size.height += frame.origin.y;frame.origin.y = 0;[theWebVIEw.supervIEw setFrame:frame];
总结

以上是内存溢出为你收集整理的如何在iOS半透明中制作PhoneGap状态栏?全部内容,希望文章能够帮你解决如何在iOS半透明中制作PhoneGap状态栏?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1011214.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存