TYAttributedLabel
TYAttributedLabel copied to clipboard
有时点击会闪下,有时候不会?能不让它闪下吗?
TYTextContainer *textContainer = [[TYTextContainer alloc]init];
// 整体设置属性
textContainer.characterSpacing = 3;
textContainer.text = @"确定按钮";
textContainer.textColor = [UIColor purpleColor] ;
textContainer.font = [UIFont systemFontOfSize:17];
textContainer.textAlignment = kCTTextAlignmentCenter;
TYTextStorage *textStorage = [[TYLinkTextStorage alloc]init];
textStorage.range = [@"确定按钮" rangeOfString:@"确定按钮"];
//textStorage.linkData = @"点击了 《诗经·国风·秦风》";
textStorage.underLineStyle = kCTUnderlineStyleNone;
[textContainer addTextStorage:textStorage];
TYAttributedLabel *lb = [[TYAttributedLabel alloc]init];
[self.view addSubview:lb];
lb.textContainer = textContainer;
lb.delegate = self;
[lb setFrameWithOrign:CGPointMake(0, 120) Width:ScreenWidth];
#pragma mark --- TYAttributedLabelDelegate
// 点击代理
- (void)attributedLabel:(TYAttributedLabel *)attributedLabel textStorageClicked:(id<TYTextStorageProtocol>)textStorage atPoint:(CGPoint)point
{
if ([textStorage isKindOfClass:[TYLinkTextStorage class]]) {
NSLog(@"点击了一下");
}
}