How do I create a button to go to a web page

Hi all,

I am new to developing an Iphone application and have a question?

I want to create an image button and when the user touches the button it takes them to a web page to display our current sales.  

What is the best way to do this?
Who is Participating?
SpeedyApocalypseConnect With a Mentor Commented:
Hello Tom,

You have a couple options here.  One of them is to have an in-house Web View to view the website or to transfer to Safari to bring up the website.

Web View

You can create a UIWebView instance through Interface Builder or by add the sub-view.  

Here is a tutorial (or two) to create the UIWebView in your application:



You can simply switch to Safari instead of hosting the web-view yourself.  However, this will lead users away from your application and could be un-wanted.

Here is an example of loading Google through Safari.  Due note, this will only work on device as the Simulator does not have Safari.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@""]];

Open in new window

If you have any other questions, please do not hesitate to ask.
tradomskiAuthor Commented:
Thank you for your help.

     The best is use WebView along with delegate -
- (void)webViewDidFinishLoad:(UIWebView *)webView

Add and activity indicator to your webview and hide it in the above delegate. It shows that process is going on. This delegate called when webview finshed loading the content of that URL

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.