在我的应用程序中,我有一个tttattributedlabel
检测链接并在 Web 视图中打开。如果我uitapgesture
在这个属性标签上设置,那么手势总是火。
如果在属性标签上设置了点击手势,则链接在任何情况下都不起作用。
问问题
126 次
1 回答
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];
}
于 2015-04-03T07:15:09.740 回答