给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 @ 2012-05-05 06:45  FoxBabe  阅读(6891)  评论(0编辑  收藏  举报