【发布时间】:2016-02-07 13:01:04
【问题描述】:
我在 YouTube 上观看了这个视频: Xcode 如何为 iOS 应用创建 Webview
我关注了视频,但如果我在模拟器上运行我的应用程序,我只会看到白屏。
这个 ViewController.h
//
// ViewController.h
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
{
IBOutlet UIWebView *myWebView;
}
@end
//
// ViewController.m //
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSURL *myURL = [NSURL URLWithString:@"http://website.com"]; NSURLRequest *myRequest = [NSURLRequest requestWithURL:myURL]; myWebView.scalesPageToFit = YES; [myWebView loadRequest:myRequest];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
你能帮我解决这个错误吗?
【问题讨论】:
-
显示代码。你的 VC 上有
UIelement吗?同时分享您的故事板的屏幕截图。 -
添加了我的代码,等你,谢谢
-
用代码更新你的问题。不要将您的更新发布为答案
标签: ios objective-c uiwebview nsurl nsurlrequest