Going to a UIWebView from an IBAction
I would like to know how do I load a web view from an开发者_如何学C "- (IBAction) buttonPressed
" function.
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];
}
Make the -(IBAction) load a new view, and put a UIWebView in that new view.
精彩评论