您的位置:首页 > 其它

用CoreText实现类似微博那样可以点击的Label

2017-04-02 00:00 253 查看

JLLabel

用CoreText实现类似微博那样可以点击的文字,自动识别@,#,http(s)等特殊字符串,用法如下:

JLLabel *contentLabel = [[JLLabel alloc] init];
contentLabel.font = [UIFont systemFontOfSize:15.0];
contentLabel.tapCallBack = ^(NSString *string,NSRange range,NSDictionary *info){

NSLog(@"点击的字符串是:%@",string);
NSLog(@"点击的字符串的范围是:%@",[NSValue valueWithRange:range]);

};
[self.contentView addSubview:contentLabel];




下载点击源代码
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐