In my application , I have a tttattributedlabel
detect link and open in web view . if I set uitapgesture
on this attributed label then gesture is always fire .
link is not working in any case if tap gesture set on attributed label .
Asked
Active
Viewed 130 times
0

Suhaib Janjua
- 3,538
- 16
- 59
- 73

Garry
- 407
- 2
- 15
-
Can you show your code please. – Monikanta Apr 03 '15 at 06:45
-
its simple a string , If string has a link and tap on link open in web view other wise fire a simple gesture ... – Garry Apr 03 '15 at 07:00
1 Answers
0
You can try with it.
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];
}

Monikanta
- 307
- 2
- 8