如何在ios中的另一个视图中单击按钮时加载UIWebView

时间:2012-07-27 02:50:56

标签: ios uiwebview

我想创建一个包含UIWebview的ios应用程序。我看到很多教程说明了如何在启动应用程序时加载webview。但我想要的是当用户点击一个视图中的链接时,网页应该以单独的视图加载。这是我的按钮点击事件中的代码。

`

 -(IBAction)visitWeb:(id)sender{
         web *wb=[[web alloc]initWithNibName:nil bundle:nil];
     [self presentModalViewController:wb animated:YES];
     [wb release];}

这是在网上

`

 - (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.
[webView loadRequest:requestObj];

[super viewDidLoad];  }

但它没有显示任何东西。只显示空UIWebView它的原因是什么.plz给我一个代码解决方案。

谢谢,

0 个答案:

没有答案