2012-03-27 9 views
0

私はXcodeのを学ぶために始めている、といくつかの問題にして実行している...のUIWebView(Xcodeの)

私はdeiredとして働くのXcode 4.3でタブ付きのアプリケーションを作りました。しかし、以前は単純なUIWebViewアプリケーションを作成しました。新しいアプリケーションのタブの1つに実装したいと思っています。

これは私がFirstViewControllerするためのクラスでやったものです:

// FirstViewController.h 
// SafeLine 
// 
// Created by Camilla Fröberg on 2012-03-27. 
// Copyright (c) 2012 SafeLine Sweden AB. All rights reserved. 
// 

#import <UIKit/UIKit.h> 

@interface FirstViewController : UIViewController { 

    IBOutlet UIWebView *webDisplay; 
} 

@property(nonatomic,retain) UIWebView *webDisplay; 


@end 

そしてFirstViewController.m:

// FirstViewController.m 
// SafeLine 
// 
// Created by Camilla Fröberg on 2012-03-27. 
// Copyright (c) 2012 SafeLine Sweden AB. All rights reserved. 
// 

#import "FirstViewController.h" 

@interface FirstViewController() 


@end 

@implementation FirstViewController 
@synthesize webDisplay; 

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 
- (void)viewDidLoad { 

    NSString *urlAddress = @"http://www.google.com"; 

    //Create a URL object. 
    NSURL *url = [NSURL URLWithString:urlAddress]; 

    //URL Requst Object 
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; 

    //Load the request in the UIWebView. 
    [webDisplay loadRequest:requestObj]; 



    [super viewDidLoad]; 
} 



// Override to allow orientations other than the default portrait orientation. 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    return YES; 
} 

- (void)didReceiveMemoryWarning { 
    // Releases the view if it doesn't have a superview. 
    [super didReceiveMemoryWarning]; 

    // Release any cached data, images, etc that aren't in use. 
} 

- (void)viewDidUnload { 
    // Release any retained subviews of the main view. 
    // e.g. self.myOutlet = nil; 
} 


@end 

私はすべてのエラーメッセージを取得することはできませんアプリケーションを実行して、ウェブサイトは表示されず、空のビューのみが表示されます...

何か助けていただきありがとうございます!スウェーデン

+1

インターフェイスビルダでUIWebViewを接続することを覚えましたか? IBOutletとして宣言しましたが、手動で接続する必要があります。もしそうでなければ、これは 'nil'になるので、何も起こりません。あなたのコードはそうでなければよく見えます。 – rosslebeau

+0

私はすべてを試しましたが、接続されているかどうかを確認することさえできませんでした。どうもありがとう! –

答えて

0

から

//敬具 カミラを私が思うあなたがIBOutletとInterface BuilderでのUIWebViewを接続した場合、あなたは確認する必要があります。