在我的应用程序中,我有一个tttattributedlabel
检测链接并在Web视图中打开。如果我在此属性标签上设置uitapgesture
,则手势始终为火
如果在属性标签上设置了点按手势,则链接无论如何都不起作用。
答案 0 :(得分:0)
你可以尝试一下。
NSString *pathStr=@"http://stackoverflow.com/questions/29427320/override-tap-gesture-in-tttaributredlabel-link?noredirect=1#comment47025717_29427320";
if ([pathStr hasPrefix:@"http"]) {
UIWebView *myWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
myWebView.autoresizesSubviews = YES;
myWebView.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
NSURL *myUrl = [NSURL URLWithString:pathStr];
NSMutableURLRequest *myRequest = [NSMutableURLRequest requestWithURL:myUrl];
[myWebView loadRequest:myRequest];
myWebView.delegate=self;
[self.view addSubview: myWebView];
}