Krunal
Krunal

Reputation: 1328

To view web page in webview

I have, for exa, "Facebook" button in SocialWeb.xib. I want that if user clicks on that button, the webview, defined in another View.xib, should view Facebook page. What is the code for View.xib that I must write?

Upvotes: 1

Views: 101

Answers (1)

nikans
nikans

Reputation: 2565

I think you should coordinate this event via your controller, anyway. Can't say exactly what to do without your code. Try this

//Load web view data
NSString *strWebsiteUlr = [NSString stringWithFormat:@"http://your.url"];

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

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

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

Upvotes: 2

Related Questions