zoukankan      html  css  js  c++  java
  • 给UITapGestureRecognizer添加tag

    UITapGestureRecognizer是没有tag属性,但他有UIView的属性,我们可以通过给UIView添加tag属性,从而标记UITapGestureRecognizer。

    UITapGestureRecognizer *singleTap =
            [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(whenClickImage:)];
            [_firstImage addGestureRecognizer:singleTap];
            UIView *singleTapView = [singleTap view];
            singleTapView.tag = 0;
            [singleTap release];

    -(void)whenClickImage:(id)sender
    {
        UITapGestureRecognizer *singleTap = (UITapGestureRecognizer *)sender;
        NSLog(@"%d",[singleTap view].tag]);
    }

    喝最烈的酒,看最美的风景。
  • 相关阅读:
    L1-031 到底是不是太胖了
    L1-030 一帮一
    PyCharm--git配置
    websocket--python
    UDP--python
    TCP--python
    pytest--metadata
    pytest--xdist
    pytest--夹具
    pytest--变量
  • 原文地址:https://www.cnblogs.com/mona/p/4644679.html
Copyright © 2011-2022 走看看