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

    }

  • 相关阅读:
    excel上传和下载
    SublimeText快捷键大全(附GIF演示图)
    JS求多个数组的重复数据
    js各种宽高(3)
    js各种宽高(2)
    js各种宽高(1)
    echarts简单使用案例
    js小技巧
    原生jdbc执行存储过程
    Cron和Spring定时任务
  • 原文地址:https://www.cnblogs.com/yuyu-2012/p/5065601.html
Copyright © 2011-2022 走看看