UILabel *labelGovUrl = [[UILabel
alloc]
initWithFrame:CGRectMake(73.0,
330.0,
180.0,
40.0)];

labelGovUrl.autoresizingMask = (UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight);

labelGovUrl.text =
@"appStore";

labelGovUrl.backgroundColor = [UIColor
clearColor];

labelGovUrl.textColor = [UIColor
blackColor];

labelGovUrl.font = [UIFont
fontWithName:@"Helvetica-Bold"
size:14];

labelGovUrl.userInteractionEnabled =
YES;

labelGovUrl.tag =
k_NNGOV_WEBSITE_LABEL_URL;

UITapGestureRecognizer *tapGesture = [[[UITapGestureRecognizer
alloc]
initWithTarget:self
action:@selector(openURL:)]
autorelease];

[labelGovUrl
addGestureRecognizer:tapGesture];

[self.window
addSubview:labelGovUrl];

[labelGovUrl
release];

-(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/";

}

[[UIApplication
sharedApplication]
openURL:[NSURL
URLWithString:url]];

}

让UILabel具有链接功能,点击后调用safari打开网址的更多相关文章

  1. AJ学IOS(45)之常用的小功能比如打电话、打开网址、发邮件、发短信打开其他应用。

    AJ分享,必须精品 简介 iOS中的很多小功能都是非常简单的,几行代码就搞定了,比如打电话.打开网址.发邮件.发短信.打开其他应用等. 打电话 方法1 最简单最直接的方式:直接跳到拨号界面 NSURL ...

  2. python+selenium调用chrome打开网址获取内容

    目录 1,安装selenium和配置chromedriver 2,调用chromedriver打开网页获取网页内容 3,模拟登陆百度云 附录(webdriver版本兼容列表) 通过selenium库, ...

  3. c# 调用浏览器打开网址并全屏

    关键性参数 Google Chrome浏览器 Process process = Process.Start("chrome.exe", " --kiosk " ...

  4. IE11,Chrome65,Firefox58 的webdriver驱动下载,调用浏览器打开网址

    一.环境及需求 1.1环境 Windows10 + Python 3.6.4 + selenium 3.141 1.2需求 工作需要实现一个网页自动登录的操作,决定使用selenium+python实 ...

  5. C# 调用浏览器打开网址

    private void button1_Click(object sender, EventArgs e) { //调用系统默认的浏览器 System.Diagnostics.Process.Sta ...

  6. [WPF]c#调用默认浏览器打开网址

    //调用系统默认的浏览器 System.Diagnostics.Process.Start("http://www.zhaokeli.com");

  7. cocos2dx调用浏览器打开网址

    安卓端cocos2dx/platform/android路径下CCApplication.h: virtual void openURL(const char* pszUrl); CCApplicat ...

  8. Android调用浏览器打开网址遇到的问题

    我自己的手机(一加一代,升级了氢OS),然后在点击游戏内一个"隐私政策"-- 需要打开一个网页,然后就crash了.出错的信息如下: 完全是看不出来,然后我单独写了一个demo来测 ...

  9. iOS 第三方应用调用safari

    一,直接调用safari打开url [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www. ...

随机推荐

  1. SPRING IN ACTION 第4版笔记-第九章Securing web applications-006-用LDAP比较密码(passwordCompare()、passwordAttribute("passcode")、passwordEncoder(new Md5PasswordEncoder()))

    一. The default strategy for authenticating against LDAP is to perform a bind operation,authenticatin ...

  2. Vue.js vui 饿了么Vue2.0的组件库

    http://www.oschina.net/news/78038/vue-js-2-0-3 http://git.oschina.net/durcframework/vui http://eleme ...

  3. python中的commands模块

    commands模块用于调用shell命令 有3中方法: commands.getstatus()   返回执行状态 commands.getoutput()   返回执行结果 commands.ge ...

  4. bzoj1453

    这是一道好题,按行建线段树,每个点维护上下边界的连通性,详细见代码注释 网上写法不一,自认为比较简单,就放出来相出来献丑吧 ..,..] of longint; //u[]上边界,d[]下边界 s,f ...

  5. jwplayer 网页在线播放插件

    1.到官网 https://www.jwplayer.com/ 注册,取得key并下载免费版本(免费版只支持mp4格式): 2.编辑如下网页即可在线播放: <!DOCTYPE html> ...

  6. MATLAB函数表(转自:http://bbs.06climate.com/forum.php?mod=viewthread&tid=16041&extra=page%3D4)

    MATLAB函数表 4.1.1特殊变量与常数 ans 计算结果的变量名 computer 确定运行的计算机 eps 浮点相对精度 Inf 无穷大 I 虚数单位 inputname 输入参数名 NaN ...

  7. 【转】禁止seekbar的拖动事件

    原文网址:http://blog.csdn.net/ansionnal/article/details/8229801 当然是可以的! 其实是 onTouchEvent 事件时,不让他传递事件就行了! ...

  8. C#用DES加密JAVA用DES解密,JAVA用DES加密C#用DES解密的实现

    这里贴出来的是可通用的C#与jav的DES加密类,希望对大家管用直接复制即可用 C#DES加密解密类 ///<summary><![CDATA[加密解密帮助类]]></s ...

  9. 变形虫mysql的负载均衡 读写分离

    变形虫概述 图片来自   http://docs.hexnova.com/amoeba/amoeba-products.html  文档上说也可以做mongdb的分布式. 应用: 具有负载均衡.高可用 ...

  10. 单实例运行tz

    (引用了 Microsoft.VisualBasic.ApplicationServices)SingleInstanceApplicationWrapper.cs    using System.W ...