Webview空白,但有内容 [英] Webview blank but content is there

查看:124
本文介绍了Webview空白,但有内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法显示网络视图。我在自定义视图中有一个webview。我将此自定义视图加载为窗口的子视图,然后让一个对象控制器将文本字段链接到Web视图的内容。加载页面后,它将加载所有内容,但外观为白色。您可以单击链接。如果您观看Youtube视频,则可以收听,但仍不显示任何内容。
要加载自定义视图,请运行:

I am having trouble displaying a webview. I have a webview inside a custom view. I load this custom view as a subview of the window, and then have an object controller linking a text field to the content of the web view. Once a page is loaded, it loads all the content, but it is visually white. You can click on links. If you go to a Youtube video you can listen to it, but it still displays nothing. To load the custom view I run:

PageViewController *page = [[PageViewController alloc] initWithNibName:@"PageView" bundle:nil];
[page loadView];
[view addSubview:[page view]];

然后要加载页面,我有以下内容:

Then to load the page I have the following:

-(IBAction)connectURL:(id)sender
{
    NSLog(@"connecting");
    [webView setMainFrameURL:[sender stringValue]];
}

connectURL绑定到文本字段的位置。

Where connectURL is bound to a text field.

推荐答案

您是否已将自定义视图设置为分层支持?您不能在层支持的视图中使用 WebView 。如果不是问题,可以张贴自定义视图的绘图代码吗?

Have you set your custom view to be layer-backed? You can't use a WebView in a layer-backed view. If that's not the problem, can you post your custom view's drawing code?

这篇关于Webview空白,但有内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆