UILabel *labelgovurl = [[ Uilabelalloc]initwithframe:< Span style= "letter-spacing:0.0px; Color: #3d1d81; " >cgrectmake73.0< Span style= "letter-spacing:0.0px;" >,330.0,180.0,40.0)];
Labelgovurl. autoresizingmask = (uiviewautoresizingflexiblewidth| uiviewautoresizingflexibleheight);
Labelgovurl. text =@ "AppStore";
Labelgovurl. backgroundcolor = [uicolorclearcolor];
Labelgovurl. textcolor = [uicolorblackcolor< Span style= "letter-spacing:0.0px;" >];
Labelgovurl. font = [uifontfontwithname< Span style= "letter-spacing:0.0px;" >:@ "Helvetica-bold" < Span style= "letter-spacing:0.0px; Color: #3d1d81; " >size:14];
Labelgovurl. userinteractionenabled =YES;
Labelgovurl. tag =K_nngov_website_label_url;
UITapGestureRecognizer *tapgesture = [[[ Uitapgesturerecognizeralloc] Initwithtarget: Self Action: @selector (OpenURL:)]autorelease ";
[LabelgovurlAddgesturerecognizer: tapgesture];
[self. Windowaddsubview: Labelgovurl];
[Labelgovurlrelease];
-(void) OpenURL: (uitapgesturerecognizer *) gesture
{
Nsinteger tag = gesture. View. Tag;
nsstring *url =nil;
if (tag = =K_nnweibo_label_url)
{
url = @ "http://t.qq.com/yourgame/";
}
if (tag = =K_nngov_website_label_url)
{
url = @ "http://www.zjnn.cn/";
}
[[uiapplicationsharedapplication]openURL: [nsurlurlwithstring: url]];
}
Let Uilabel have link function, click on safari to open URL