UIWebView显示问题

发布于 2024-12-07 03:47:01 字数 983 浏览 1 评论 0原文

我遵循了本教程 http://bytedissident.theconspiracy5.com/2010/11/ 24/uiwebview-tutorial/ 当我在 Xcode 中运行模拟时,显示的只是一个空白的白屏。我想知道可能出了什么问题。我是否缺少某种与互联网的代码连接?我真的不知道出了什么问题。

WebPageViewController.m #import“WebPageViewController.h”

@implementation WebPageViewController
@synthesize wView;
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {

[super viewDidLoad];

//a URL string
NSString *urlAddress = @"http://www.nd.edu";

//create URL object from string
NSURL *url = [NSURL URLWithString:urlAddress];

//URL Request Object created from your URL object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

//Load the request in the UIWebView
[wView loadRequest:requestObj];

//scale page to the device - can also be done in IB if preferred.
//wView.scalesPageToFit = YES;

}

I followed this tutorial http://bytedissident.theconspiracy5.com/2010/11/24/uiwebview-tutorial/ and when I run the simulation in Xcode, all that is displayed is a blank white screen. I'm wondering what could be wrong. Is there some sort of code connection to the internet that i'm missing? I really don't know what could be wrong.

WebPageViewController.m
#import "WebPageViewController.h"

@implementation WebPageViewController
@synthesize wView;
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {

[super viewDidLoad];

//a URL string
NSString *urlAddress = @"http://www.nd.edu";

//create URL object from string
NSURL *url = [NSURL URLWithString:urlAddress];

//URL Request Object created from your URL object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

//Load the request in the UIWebView
[wView loadRequest:requestObj];

//scale page to the device - can also be done in IB if preferred.
//wView.scalesPageToFit = YES;

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光无声 2024-12-14 03:47:01

您是否将 .xib 连接到您创建的 WebPageViewController 类?您可以通过在编辑器中选择 .xib 进行检查,并在“自定义类”下的“类”字段中的“文件所有者”上使用身份检查器

Did you connect the .xib to the WebPageViewController class you created? You can check by selecting the .xib in the editor, and use identity inspector on 'File's Owner' in the Class field under Custom Class

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文