0

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 .

Suhaib Janjua
  • 3,538
  • 16
  • 59
  • 73
Garry
  • 407
  • 2
  • 15

1 Answers1

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