恐怕 UIWebView 将是唯一适合这里的东西。数据检测器是链接 UITextView 内部的唯一方法,它们只会响应适当的数据类型(电话号码、网页、地址)...
链接可以正常方式完成:
<a href='http://someotherword'>someotherword</a>
设置 webviewdelegate 以捕获任何链接请求(并阻止它们在浏览器中打开),以便您可以在自己的处理程序中打开它们:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
{
if(navigationType == UIWebViewNavigationTypeOther) return YES; // Allow direct loading
NSString *myWord = [[request URL] host];
// do something with myWord... say open another word
return NO; // Don't let the browser actually perform this navigation
}