As of iOS 7, UITextView
supports links in attributed strings:
textView.attributedText = [[NSAttributedString alloc] initWithString:@"Stack Overflow" attributes:@{NSLinkAttributeName: @"http://stackoverflow.com"}];
By default, links are rendered as blue text. You can change the style with UITextView
's linkTextAttributes
property.
If you set editable
to NO
on the UITextView
, links become tappable.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…