0

私のアプリケーションでは、tttattributedlabel検出リンクがあり、Web ビューで開きます。この属性ラベルを設定uitapgesture すると、ジェスチャーは常に fire になります。
属性付きラベルに設定されたタップ ジェスチャの場合、リンクはどのような場合でも機能しません。

4

1 に答える 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 に答える