Displaying a background image on UIWebView(在 UIWebView 上显示背景图像)
问题描述
我正在尝试构建一个原生应用程序,该应用程序的所有意图和目的都是 HTML/CSS 和 Javascript.一切正常,但是当 UIWebView 加载时,在填充 DOM、检索图像等时会有延迟.
I'm trying to build a native application that for all intents and purposes is HTML/CSS and Javascript. It all works fine, but when the UIWebView loads there's a delay while the DOM is populated, images retrieved etc.
到底有没有在 UIWebView 上显示背景图像,或者它背后的东西?理想情况下,这将与初始屏幕相同,因此不会影响从斜线过渡到应用的体验.
Is there anyway to display a background image on the UIWebView, or something behind it? Ideally this will be the same as the splash screen so it doesn't affect the experience of transitioning from slash to app.
谢谢
罗比
推荐答案
我不相信你想将 UIWebView 设置为透明并在其后面显示图像.
I don't believe you want to be setting the UIWebView as transparent and showing an image behind it.
相反,在 UIWebView 加载其内容之前,您应该有某种视图(可能带有您建议的图片,可能带有 UIIndicator 和使页面变暗"的半透明视图).
Instead you should have some sort of view (maybe with a picture as you suggest, maybe with a UIIndicator and a semi-transparent view that "darkens" the page) that sits there until the UIWebView has loaded its content.
为此,首先你的类应该订阅 UIWebViewDelegate 协议:
To do this, first your class should subscribe to the UIWebViewDelegate protocol:
@interface myWebView : UIViewController <UIWebViewDelegate> {
// variables etc
}
然后,您可以在加载时显示视图:
Then, you can show a view on load:
-(void)viewDidLoad {
myView.hidden = NO;
}
最后,您可以覆盖 webViewDidFinishLoad 方法以在加载后将其隐藏
And finally, you can override the webViewDidFinishLoad method to hide it once it's loaded
- (void)webViewDidFinishLoad:(UIWebView *)localwebView {
myView.hidden = YES;
}
这篇关于在 UIWebView 上显示背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 UIWebView 上显示背景图像
基础教程推荐
- iOS4 创建后台定时器 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
