0

TTTAttributedLabel在我的应用程序中使用 URL 和电话号码。一切正常,但问题是现在我需要在UILabel. 在我使用下面给出的代码之前。但由于使用TTTAttributedLabelnowNSTextAttachment没有显示在TTTAttributedLabel. TTTAttributedLabel不支持附件。那么有什么想法可以支持 URL、电话号码和图标UILabel吗?


现在我决定在 TTTAttributedLabel 中显示 unicode 图像。它工作正常。

4

1 回答 1

1

最好使用 UITextView 并设置 textView 的数据检测器类型。

textView.dataDetectorTypes = UIDataDetectorTypeAddress | UIDataDetectorTypeLink |     UIDataDetectorTypePhoneNumber;

There is one delegate methods that is called when the link or url in the text view is selected

- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange NS_AVAILABLE_IOS(7_0);

这为您提供了在文本视图中点击的 URL,您可以执行所需的操作。

于 2014-12-31T06:21:35.983 回答