Opening URL in browser by clicking button

hyperlink, ios7, objective-c, title

Solution

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.stackoverflow.com"]];

Will open a URL by the Application defined for the scheme. http has Safari as default (I guess)

To open it in the App itself create a ViewController + xib, add a UIWebView to your View & Buttons to get back to the app.

Then you can create an instance of your new ViewController and present it with

[self presentViewController:WebVC animated:YES completion:^(void){
    [[WebVC MyWebView] loadRequest: [NSMutableURLRequest requestWithURL:[NSURL URLWithString: @"http://stackoverflow.com"]];
}];

e.g.

To make it even easier you could add a function to your ViewController like this one

-(void) LoadUrlFromString: (NSString *)url{
[self.MyWebView loadRequest: [NSMutableURLRequest requestWithURL:[NSURL URLWithString: url]]];
}

and then just do as before but call

[WebVC LoadUrlFromString:@"http://stackoverflow.com"]; 

on completition

Problem

Hi friends, I am getting data from server when user post a link on his timeline am displaying like this but my requirement is when i click Title then it will open browser. How can i do this?

Original source