当我在应用程序中单击按钮时,我正在创建一个UIImageView
'posts_per_page' => -1
但是当我点击相同的视图时,如何关闭呢?
答案 0 :(得分:0)
您可以在UITapGestureRecognizer
中添加UIImageView
,然后将其UIImageView
移除。
//Add tap Gesture
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissTapGesture:)];
[dot addGestureRecognizer:tapGesture];
//Set userInteractionEnabled property of imageView to true because by defaults its false
dot.userInteractionEnabled = YES;
现在只需通过UIImageView
的操作方法删除UITapGestureRecognizer
。
- (void)dismissTapGesture:(UITapGestureRecognizer*)gesture {
[gesture.view removeFromSuperview];
}