Closed sulizhan closed 8 years ago
TextBorder 设置为BackgroundBorder 之后 似乎需要长按才能显示 但是action却只需要点击就能触发。但是我看你写的yykit的demo里面是正常的,这中间有什么需要注意的吗?
NSString * nameString = [userDict stringValueForKey:@"uname"]; NSMutableAttributedString *one = [[NSMutableAttributedString alloc] initWithString:nameString]; one.yy_font = [UIFont boldSystemFontOfSize:12]; one.yy_color = [UIColor colorWithARGB:0x336699];
YYTextBorder *highlightBorder = [YYTextBorder new]; highlightBorder.insets = UIEdgeInsetsMake(-2, 0, -2, 0); highlightBorder.cornerRadius = 3; highlightBorder.fillColor = [UIColor colorWithARGB:0xbfdffe]; YYTextHighlight *highlight = [YYTextHighlight new]; [highlight setBackgroundBorder:highlightBorder]; highlight.tapAction = ^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect) { NSLog(@"%@",userDict); }; [one yy_setTextHighlight:highlight range:one.yy_rangeOfAll];
检查一下是否有 UIGestureRecognizer 延迟了触摸事件,或者是被 UIScrollView.delaysContentTouches 延迟了。
好吧 我找到原因了。 确实如你所说! 非常感谢。
TextBorder 设置为BackgroundBorder 之后 似乎需要长按才能显示 但是action却只需要点击就能触发。但是我看你写的yykit的demo里面是正常的,这中间有什么需要注意的吗?
NSString * nameString = [userDict stringValueForKey:@"uname"]; NSMutableAttributedString *one = [[NSMutableAttributedString alloc] initWithString:nameString]; one.yy_font = [UIFont boldSystemFontOfSize:12]; one.yy_color = [UIColor colorWithARGB:0x336699];