简体   繁体   English

在UIView前面显示UIImageView

[英]Show UIImageView in front of UIView

Is there a way to show a UIImageView in front of a UIView (for Preview live)? 有没有办法在UIView前面显示UIImageView(用于预览直播)? I try to make a camera based application so when clicking on a button the app take a pic and show it into UIImageView. 我尝试制作一个基于摄像头的应用程序,所以当点击按钮时,应用程序会拍摄照片并将其显示到UIImageView中。

[myView addSubview: myImageView]

should work fine. 应该工作正常。 if not please post your code. 如果没有,请发布您的代码。

If you are adding the view programmatically the previous suggestion should do it. 如果您以编程方式添加视图,则先前的建议应该执行此操作。 If the views are in a storyboard or XIB and you want to move it to the front, try this: 如果视图位于故事板或XIB中,并且您想将其移到前面,请尝试以下操作:

[self.view bringSubViewToFront:myImageView];

You might want to use UIKit Peek and Pop if you are on iOS 9 or above. 如果您使用的是iOS 9或更高版本,则可能需要使用UIKit Peek和Pop

Also there is this tutorial: http://useyourloaf.com/blog/3d-touch-peek-and-pop/ 还有本教程: http//useyourloaf.com/blog/3d-touch-peek-and-pop/

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

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