标签:
点击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];
}
IOS UILabel用UITapGestureRecognizer实现点击事件
标签:
原文地址:http://www.cnblogs.com/yuyu-2012/p/5065601.html