//初始化UILable UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(60, 0, 320, 40)]; //设置其可以接收用户交互的事件(默认情况下为NO) lable.userInteractionEnabled=YES; //创建一个手势事件 UITapGestureRecognizer *labelTapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(labelTouchUpInside:)]; //UILable与事件绑定 [lable addGestureRecognizer:labelTapGestureRecognizer];
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/liufangbaishi2014/article/details/47208193