How to make a string clickable using Twui?
I have a project base on twitter's twui framework.I'm trying to made a string clickable just like
[s addAttribute:NSLinkAttributeName value:@"http://apple.com/" range:attrRange];
i开发者_开发知识库n NSMutableAttributedString, or performing a selector when clicked.
TUITextRender can draw a NSAttributedString, but "NSLinkAttributeName" doesn't work.
I can't find any method or delegate to solve this in TUITextView too.
How can I done this with twui?
After read source code, I figured it out.
- Store ranges in a array of
ABActiveRange
(Which contains in twui) subclass. - Implement
TUITextRendererDelegate
in yourUIViewController
. - In the
activeRangesForTextRenderer:
delegate method, return the array you made in step 1. - Enjoy ~
精彩评论