美文网首页
给UIImageView UILabel等没有自带点击事件的vi

给UIImageView UILabel等没有自带点击事件的vi

作者: Mr_Dragonn | 来源:发表于2016-06-01 10:38 被阅读72次
      UIImageView * imview = [[UIImageView alloc]init];
        imview.frame = CGRectMake(10, 10, 200, 200);
        imview.backgroundColor = [UIColor blueColor];
        [self.view addSubview:imview];
        imview.userInteractionEnabled = YES;
        [imview addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(haha)]];
    
    -(void)haha{
        
            NSLog(@"xxxxx");
        
    }
    

    相关文章

      网友评论

          本文标题:给UIImageView UILabel等没有自带点击事件的vi

          本文链接:https://www.haomeiwen.com/subject/kjdhdttx.html