ibireme / YYText

Powerful text framework for iOS to display and edit rich text.
MIT License
8.86k stars 1.7k forks source link

设置TextBorder问题 #177

Closed sulizhan closed 8 years ago

sulizhan commented 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];
ibireme commented 8 years ago

检查一下是否有 UIGestureRecognizer 延迟了触摸事件,或者是被 UIScrollView.delaysContentTouches 延迟了。

sulizhan commented 8 years ago

好吧 我找到原因了。 确实如你所说! 非常感谢。