iOS 给UILabel增加超链接

来源:互联网 发布:mac os 10.10下载 编辑:程序博客网 时间:2024/06/05 07:26
UITapGestureRecognizer*tapRecognizer1=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickurl1:)];
            self.inviteLabel.userInteractionEnabled=YES;

            [self.inviteLabel addGestureRecognizer:tapRecognizer1];


- (void)clickurl1:(id)sender{
#warning 网址换一下
    NSString *path=self.url;
    [[UIApplication sharedApplication]openURL:[NSURL URLWithString:path]];
}

0 0