views:

16

answers:

1

In xcode, how do I link an object to a URL so that when a user taps the object, it automatically links him to the URL. I already have a table view with some objects on it

A: 

Assuming you want to display the content within your application, a UIWebView is what you want to use.

The UIWebView Class Reference has links to several samples.

--- edit --- To open a URL in Safari, use the -openURL method on UIApplication. For example:

// launch Safari app (we exit)
if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://stackoverflow.com"]]) { 
    UIAlertView *openURLAlert = [[UIAlertView alloc] initWithTitle:@"Error launching Safari" 
                message:@"Sorry, unable to launch Safari application"
                delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [openURLAlert show];
    [openURLAlert release];
}
David Gelhar
I would like to open it with safari
rifkeey
Thanks for d help..it worked... Now the only problem left is in the detail view after you tap in the table view. I have a label, UIImageView and UITextView. The first two are okay but I don't know how to display data in the UITextView. I want it hardcode inside the coding.
rifkeey