KBouldin9
KBouldin9

Reputation: 404

UIButton connect to html <a href = "">

Can the action of an objective c UIButton call a link from an html webpage? I set up a UIWebView to a certain url, and want the page to change automatically to a different url when a button is clicked on the view.

Upvotes: 0

Views: 180

Answers (1)

ohr
ohr

Reputation: 1727

Yes, you should only need these methods.

//First initialize the NSURLRequest.
- (id)initWithURL:(NSURL *)theURL
//Fire the request.
- (void)loadRequest:(NSURLRequest *)request

In your IBAction.

//In your IBAction
NSURLRequest *req = [NSURLRequest initWithURL:[NSURL URLWithString:yourURL]];
[webView loadRequest:req];

Upvotes: 2

Related Questions