我有图像视图。当我单击 imageView 时,它会显示。I used UIGestureRecognizer
平移,旋转,长按。我用于UILongPressGestureRecognizer
删除 imageview。单击图像后,imageView 未显示。
代码:
-(void)img:(id)sender {
[self.view addSubView:myImageView];
UILongPressGestureRecognizer *sslongpress=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(sslongPress:)];
[myImageView addGestureRecognizer:sslongpress];
}
-(void)sslongPress:(UILongPressGestureRecognizer*)sender {
[myImageView removeFromSuperview];
}