2 ooomiao oOOMIAO 于 2013.02.25 10:20 提问

UIWebView加载未成功

应用中有四个视图控制器(四个选项卡),需要用UIWebView加载一个URL。

代码如下:
FourthViewController.h

#import <UIKit/UIKit.h>
@interface FourthViewController : UIViewController {

    IBOutlet UIWebView *webView;
}

@property(nonatomic,retain)IBOutlet UIWebView *webView;
@end

FourthViewController.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

但是在模拟器中运行后,加载未成功。请高手指点一下,谢谢。

2个回答

wangyaninglm
wangyaninglm   Ds   Rxr 2015.01.14 14:51

http://blog.csdn.net/lovenjoe/article/details/7498238
你看一下这两种加载方法

ppiee1
ppiee1   2017.02.27 10:48

我怀疑你安全设定没弄好

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!