UILable点击事件

 UILabel *lLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 19, 105, 1)];
    lLabel.backgroundColor = getColorWithRGB(40, 125, 244, 1.0);
    [protocolImageView addSubview:lLabel];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(userProtocolLogin:)];
    tap.numberOfTouchesRequired = 1;
    tap.numberOfTapsRequired = 1;
    [readLastLabel addGestureRecognizer:tap];



UILabel *readLastLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 110, 19)];
    readLastLabel.backgroundColor = [UIColor clearColor];
    readLastLabel.text = @"用户协议";
    readLastLabel.textColor = getColorWithRGB(40, 125, 244, 1.0);
    readLastLabel.font = [UIFont systemFontOfSize:14.0f];
    readLastLabel.userInteractionEnabled = YES;
    [protocolImageView addSubview:readLastLabel];

  

原文地址:https://www.cnblogs.com/songxing10000/p/4457791.html