2012-09-01 69 views
0

我正在實現一個基本上加載網頁的應用程序(通用於iphone和ipad)。 iPhone的webview加載正確,但iPad WebView無所事事?WebView for iPad未加載頁面

繼承人我ViewController.m

#import "ViewController.h" 

@interface ViewController() 
@property (weak, nonatomic) IBOutlet UIWebView *webView; 
@property (weak, nonatomic) IBOutlet UIWebView *webViewiPad; 

@end 

@implementation ViewController 
@synthesize webView = _webView; 
@synthesize webViewiPad = _webViewiPad; 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 

    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.at"]]]; 
    [self.webViewiPad loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.at"]]]; 
} 
+0

你請勿實例化您的任何Web視圖。 – 2012-09-01 12:23:10

+0

檢查您的互聯網連接在ipad – Rajneesh071

+0

互聯網連接正在工作... –

回答

0

當視圖控制器被載入做到這一點:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 

    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil] autorelease]; 
    } 
else 
{ 
    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease]; 
} 

綁定webViewiPad iPad的廈門國際銀行和web視圖分別向廈門國際銀行iPhone

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) //load differnt xib according to iphone and ipad 
{ 
    [self.webViewiPad loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.at"]]]; 

} 
else 
{ 
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.at"]]]; 

} 
+0

這與我相信的問題並不完全相關。 – 2012-09-01 12:25:05

+0

謝謝。但其變化不大。 iPhone正在工作,iPad沒有加載任何東西。 –

+0

檢查編輯答案 –