oOOMIAO 2013-02-25 02:20 采纳率: 10%
浏览 3371

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条回答 默认 最新

  • shiter 人工智能领域优质创作者 2015-01-14 06:51
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退