开发者

how to create a hyperlink for the 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜