用于识别Label中的@用户-话题##-链接
self.demoLabel.userTapHandler = ^(HYLabel *label, NSString *user, NSRange range){
NSLog(@"%@", label);
NSLog(@"%@", user);
NSLog(@"%@", NSStringFromRange(range));
};
self.demoLabel.linkTapHandler = ^(HYLabel *label, NSString *link, NSRange range){
NSLog(@"%@", label);
NSLog(@"%@", link);
NSLog(@"%@", NSStringFromRange(range));
};
self.demoLabel.userTapHandler = ^(HYLabel *label, NSString *topic, NSRange range){
NSLog(@"%@", label);
NSLog(@"%@", topic);
NSLog(@"%@", NSStringFromRange(range));
};
// 监听@谁谁谁的点击
demoLabel.userTapHandler = { (label, user, range) in
print(label)
print(user)
print(range)
}
// 监听链接的点击
demoLabel.linkTapHandler = { (label, link, range) in
print(label)
print(link)
print(range)
}
// 监听话题的点击
demoLabel.topicTapHandler = { (label, topic, range) in
print(label)
print(topic)
print(range)
}