我创建了一个带有网络视图的简单应用,但它并没有出现。仅显示空白页面。我的.xib包含UIWebView
我的文件ViewController.h:
#import <UIKit/UIKit.h>
@interface TestAViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIWebView *webview;
@end
我的文件ViewController.m:
#import "TestAViewController.h"
@interface TestAViewController ()
@end
@implementation TestAViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
// Do any additional setup after loading the view, typically from a nib.
//load url into webview
NSString *strURL = @"http://www.google.it";
NSURL *url = [NSURL URLWithString:strURL];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[self.webview loadRequest:urlRequest];
}
@end
为什么会这样?感谢。