How to open UITextView web links in a UIWebView instead of Safari?
来源:互联网 发布:数据结构 java 编辑:程序博客网 时间:2024/05/16 15:02
http://stackoverflow.com/questions/1305544/how-to-open-uitextview-web-links-in-a-uiwebview-instead-of-safari
The simplest way is to override thewebView:decidePolicyForNavigationAction:request:frame:decisionListener:
method onUITextView
like so:
@interface UITextView (Override)
@end
@class WebView, WebFrame;
@protocol WebPolicyDecisionListener;
@implementation UITextView (Override)
- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id < WebPolicyDecisionListener >)listener
{
NSLog(@"request: %@", request);
}
@end
This will affect all UITextView
s in your application. If you only require this on a single view, create a subclass and override the method on that.
Note: this is technically a private API and could be removed at any time. There is no way to do this via the public API.
- How to open UITextView web links in a UIWebView instead of Safari?
- how to change a symbolic link instead of deleting it?
- how to use Decimal by default instead of float in python
- How to debug mobile safari in iOS
- How To Open Number Of Sites With A Single Click ?
- Java - How to change context root of a dynamic web project in eclipse
- How to change context root of a dynamic web project in Eclipse
- How to properly logout of a Java EE 6 Web Application after logging in
- How to Open a Text File in VB .NET
- How to open a popup window in infopath
- How To Open An URL In Android’s Web Browser
- [LINUX LIVE USB]How to Make a bootable USB Drive to Install Fedora instead of using a physical DVD
- How to open a JFrame
- How to open a file
- iphone打开文本视图中的超连接显示在网页视图中。opening links in a UITextView in a web view
- How to prevent resizing of views in a splitter window
- How to set background image of a component in GWTEXT
- How to use the pointer of function in a class?
- 开启/关闭SELinux
- javascript判断汉字的四种方法
- 在Linux控制台下显示JPEG图像
- Socket服务器与客户端双向通信实例
- ehcache.xml
- How to open UITextView web links in a UIWebView instead of Safari?
- Virtualbox U盘启动
- Marquee的用法(转自http://bbs.cnnas.com/www/html/31/t-1131.html)
- History of C++
- oracle 10g em、isqlplus访问不了的问题解决(汇编)
- ResultSetMetaData
- Win32汇编:创建简单的窗口
- cidaemon.exe进程cpu使用率100%
- 关于嵌入式Linux系统的启动(转)