简体   繁体   English

如何在iOS中关闭全屏图像?

[英]How can I dismiss a full screen image in iOS?

I have a view with an image and various details. 我有一张带有图片和各种细节的视图。

I want to click on the image and display in full screen. 我想单击图像并全屏显示。

For now I use a button to display the image and then a segue I go to a UIViewController that displays the image in full screen. 现在,我使用按钮来显示图像,然后选择要转到全屏显示图像的UIViewController。

But I want to return to the previous view by swipe down on the image, with an effect as in the app of Facebook, Twitter, Ebay... 但是我想通过向下滑动图像返回到以前的视图,其效果就像在Facebook,Twitter,Ebay的应用中一样。

I don't want to use dismissViewControllerAnimated because it does not have the same effect. 我不想使用dismissViewControllerAnimated,因为它没有相同的效果。

Thank you! 谢谢!

尝试在图像视图上添加TapGesture以显示,并根据需要添加PenGesture或SwipeGesture以关闭。

You can Try tap gesture 您可以尝试点击手势

-(void)viewDidLoad{
UITapGestureRecognizer *tapImageRemover = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(RemoveImageAction:)];
[yourImageView addGestureRecognizer:tapImageRemover];
}


- (void)RemoveImageAction:(UITapGestureRecognizer*)sender {
     //Hear You Can Put Code For Remove Image Like [yourImageView removeFromSuperview];
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM