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");
}
网友评论