给UIImageView添加点击事件

UIImageView *imageview1 = [[UIImageView alloc] initWithFrame:CGRectMake(125, 50, 229, 229)];
        [imageview1 setImage:[UIImage imageWithContentsOfFile:path]];
        imageview1.userInteractionEnabled = YES;
        UITapGestureRecognizer *singleTap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(buttonpress1:)];
        [imageview1 addGestureRecognizer:singleTap1];
        [singleTap1 release];
        [myScrollView addSubview:imageview1];
        [imageview1 release];

 

posted on 2015-03-23 16:07  西瓜999  阅读(186)  评论(0编辑  收藏  举报

导航