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];

    }

  • 相关阅读:
    in exists
    oracle 12514文件解决
    oracle11g自动内存管理
    lvs为何不能完全替代DNS轮询
    druid安装
    macbook 安装win7
    GBT MBR
    python的文件操作
    zabbix简易安装指南
    zatree的安装
  • 原文地址:https://www.cnblogs.com/yuyu-2012/p/5065601.html
Copyright © 2011-2022 走看看