我有一个带有四个视图控制器(四个选项卡)的应用程序,我正在尝试第四个使用 UIWebView 加载 url .. 请检查下面的代码
这个FourthViewController.h
#import <UIKit/UIKit.h>
@interface FourthViewController : UIViewController {
IBOutlet UIWebView *webView;
}
@property(nonatomic,retain)IBOutlet UIWebView *webView;
@end
第四视图控制器.m
#import "FourthViewController.h"
@interface FourthViewController ()
@end
@implementation FourthViewController
@synthesize webView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
//self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.navigationItem.title = @"Instagram";
self.view.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
UIBarButtonItem *refreshButton = [[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
target:self action:@selector(refreshClicked:)] init];
self.navigationItem.rightBarButtonItem = refreshButton;
NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}
-(IBAction)refreshClicked:(id)sender {
NSLog(@"Clicked");
}
- (NSString *)tabImageName
{
return @"instagram";
}
@end
但是当我运行 iPhone 模拟器并进入第四个选项卡时,它不会加载网络,这是什么问题?
提前致谢