从IBAction转到UIWebView

时间:2011-03-07 03:58:11

标签: iphone objective-c uiwebview ibaction

我想知道如何从“- (IBAction) buttonPressed”函数加载Web视图。

2 个答案:

答案 0 :(得分:2)

IBOutlet UIWebView *webView;

   -(IBAction)click

    {
        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];


    }

答案 1 :(得分:0)

使 - (IBAction)加载一个新视图,并将UIWebView放入该新视图中。