开发者

how to create a hyperlink for the NSString variable

开发者 https://www.devze.com 2023-01-22 08:05 出处:网络
I am new to iPhone developemnt. NSString myUrl = @\"www.google.com\"; I need to know how to create a hyperlink for the above NSString variable.

I am new to iPhone developemnt.

NSString myUrl = @"www.google.com";

I need to know how to create a hyperlink for the above NSString variable.

In the MFMailComposeViewController I need to use like below

[mailViewController setMessageBody:myUrl isHTML:YES];

Please help me out.

开发者_StackOverflowThanks for any help.


The easiest way is to make the UILabel into a UIButton, style it (use Custom type to get rid of button look). Then connect to an Action that opens safari.

The action should do this:

NSURL *url = [[[ NSURL alloc ] initWithString: @"http://www.example.com" ] autorelease]; 
[[UIApplication sharedApplication] openURL:url]; 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号