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

    }

  • 相关阅读:
    hadoop 2.x 简单实现wordCount
    httpClient连接超时设置
    Java io使用简介
    log4j使用教程
    F#中的自定义隐式转换
    Computation expressions and wrapper types
    Introducing 'bind'
    Understanding continuations
    Computation expressions: Introduction
    MySQL优化总结,百万级数据库优化方案
  • 原文地址:https://www.cnblogs.com/yuyu-2012/p/5065601.html
Copyright © 2011-2022 走看看