zoukankan      html  css  js  c++  java
  • IOS UILabel用UITapGestureRecognizer实现点击事件

         点击UILabel跳转页面:

         //定义UILabel

        @property (weak, nonatomic) IBOutlet UILabel *nameLabel;

        用UITapGestureRecognizer手势触碰实现UILabel的点击事件

        UITapGestureRecognizer *tapName = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchHeaderImageView:)];

        self.nameLabel.userInteractionEnabled = YES;

        [self.nameLabel addGestureRecognizer:tapName];

        

       

    - (void)touchHeaderImageView:(UITapGestureRecognizer *)gesture

    {

        if (self.delegate && [self.delegate respondsToSelector:@selector(touchPersonalMoment:)])

        {

            [self.delegate touchPersonalMoment: self.commentTable.createUserId];

        }

    }

       

    - (void)touchPersonalMoment:(NSString *)friendId

    {

        FriendDetailViewController *viewController = [[FriendDetailViewController alloc] initWithNibName:@"FriendDetailViewController" bundle: nil];

        viewController.hidesBottomBarWhenPushed = YES;

        viewController.friendId = friendId;

        [self.navigationController pushViewController: viewController animated: YES];

    }

  • 相关阅读:
    Spark的精简安装步骤---陈楠心血总结
    关于Hadoop的集群环境下虚拟机采用NAT方式连不上网的解决
    size_t总结
    POJ 1852 Ants
    Digital Roots 1013
    1350. Primary Arithmetic
    Word Reversal
    POJ 2876 Cantoring Along
    逆序数的求法
    C++ 中cin
  • 原文地址:https://www.cnblogs.com/yuyu-2012/p/5065601.html
Copyright © 2011-2022 走看看