TT样式文本标签
我试图让这个控件与超文本链接一起使用,但没有取得太大成功。我查看了 TTCalaog 并尝试复制但不起作用。
我可以显示超文本链接,但它不会触发。
TTStyledTextLabel* 标签 = [[[TTStyledTextLabel alloc] initWithFrame:CGRectMake(5, 0, 315, 175)] autorelease];
NSString* labelText = @"这应该有效";
label.text = [TTStyledText textFromXHTML:labelText lineBreaks:NO URLs:YES];
[self.view addSubview:标签];
我想我在这里可能遗漏了谷歌网址的位置?我在这个论坛上看到过一篇文章,它使用了 custom-uri://some/url,然后在 TTURLMap 和 TTNavigator 中设置,但我需要从 web 视图中的超文本中打开一个 url,所以我需要该 url在我的类中运行一个方法来创建我的 webview 控制器等。
我尝试自定义 TTURLMap 在没有 TTNavigator 的情况下工作,但完全腌制了?
任何帮助感激不尽;-)
谢谢
I'm trying to get this control to work with a hypertext link with not much success. I have looked at TTCalaog and tried to replecate but does not work.
I have this working as far as displaying the hypertext link but it does not fire.
TTStyledTextLabel* label = [[[TTStyledTextLabel alloc] initWithFrame:CGRectMake(5, 0, 315, 175)] autorelease];
NSString* labelText = @"This should work";
label.text = [TTStyledText textFromXHTML:labelText lineBreaks:NO URLs:YES];
[self.view addSubview:label];
I thing I am missing the point here perhaps with the placement of the google url? I have seen a post on this forum that makes use of custom-uri://some/url that is then set up in TTURLMap and TTNavigator, but I need to open a url from the hypertext in a webview so I need the url to run a method in my class that creates my webview controller etc.
I have tried to cusomise TTURLMap to work without a TTNavigator but completely pickled?
Any help gratefullt appreciated ;-)
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚找到了一个解决方案来捕获 TTStyledTextLabel 上单击的 URL。我希望这对您的情况也有帮助。
这就是我所做的。
1.创建TTNavigator
2.创建 TTNavigatorDelegate
当您将 self 指定为导航器对象的委托时。因此,请记住在继续之前在头文件 .h 中添加协议。
在实现中,创建这个方法
我希望这有帮助!如果这有助于解决您的问题,请为我投票!
最好的问候,
唐
I've just found myself a solution to catch the clicked URL on a TTStyledTextLabel. I hope this could help in your case too.
This's what I have done.
1. Create TTNavigator
2. Create TTNavigatorDelegate
As you assigned self as delegate of the navigator object. Therefore, please remember to add protocol in the header file .h before you continue.
In the implementation, create this method
I hope this helps! Please vote for me if this helps to solve your issue!
Best Regards,
Thang