在Xcode 4.2中的UIWebView中加载网页 - 如何正确连接IBOutlets并确保加载网页? [英] Loading web page in UIWebView in Xcode 4.2 — how to connect IBOutlets properly and ensure the web page loads?

查看:239
本文介绍了在Xcode 4.2中的UIWebView中加载网页 - 如何正确连接IBOutlets并确保加载网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数关于在iPhone应用程序中嵌入UIWebView的教程都基于旧版本的Xcode。以下是一个示例: http://howtomakeiphoneapps.com/uiwebview-tutorial/239/

Most tutorials on embedding a UIWebView in an iPhone app are based on older versions of Xcode. Here's an example: http://howtomakeiphoneapps.com/uiwebview-tutorial/239/

我们按照该教程中的步骤进行操作,但步骤并未完全转换为Xcode 4.2

We followed the steps in that tutorial, but the steps don't quite translate to Xcode 4.2

没有文件所有者的概念例如,但是有一个故事板。

There is no concept of a File Owner, for instance, but there is a "storyboard."

另一个问题:如何将UIWebView链接到UIWebView IBOutlet?

Another question: how to link the UIWebView to the UIWebView IBOutlet?

当我们添加UIWebView并将其连接到ViewController时,我们看到的只是一个白色屏幕。网页永远不会加载。

When we add the UIWebView and connect it to the ViewController, all we see is a white screen. The web page never loads.

有没有人可以分享使用UIWebView for Xcode 4.2加载网页的提示?

Could anyone share tips on loading a web page with UIWebView for Xcode 4.2?

推荐答案

如果您正在使用故事板,文件所有者仍然在那里,但它被称为视图控制器。因此,要将故事板中的UIWebView链接到UIWebView插座,请按住控件,然后单击并从视图控制器拖动一行到Web视图。这都在故事板左侧的视图控制器场景面板中。

If you're using a storyboard, the file owner is still there but it's called View Controller. So to link the UIWebView in the storyboard to the UIWebView outlet, you hold down control, then click and drag a line from the View Controller to the Web View. This is all in the 'View Controller Scene' panel to the left of the storyboard.

请注意,当您首次从单视图应用程序模板创建项目时,没有需要勾选使用故事板复选框。如果你不使用故事板,你可能会发现更容易理解这些较旧的教程。

Note that when you first create your project from the Single View Application template, there's no need to leave the 'Use Storyboard' checkbox ticked. You might find it easier to follow these older tutorials if you don't use a storyboard.

顺便说一句,另一个重要的复选框,就在使用故事板下,是'使用自动参考计数'。这是一个很棒的功能,但是如果你在跟踪你链接的教程时打开它,你需要跳过他发布 webView的部分实例变量。

By the way, another important checkbox, just under 'Use Storyboard', is 'Use Automatic Reference Counting'. This is a great feature, but if you have it turned on while you're following the tutorial you've linked to, you'll need to skip the part where he releases the webView instance variable.

这篇关于在Xcode 4.2中的UIWebView中加载网页 - 如何正确连接IBOutlets并确保加载网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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