简体   繁体   English

如何显示视图控制器上存在的UIButton

[英]How to show UIButtons present on the view controller

I had a UIViewController on whose view I had started an AVCaptureSession and added two UIButtons to capture photos and close the camera, 我有一个UIViewController在其视图上启动了AVCaptureSession并添加了两个UIButtons来捕获照片并关闭相机,

I was facing the issue that the AVCaptureSession was also getting rotated when I was rotating the device, 我面临的问题是,旋转设备时AVCaptureSession也被旋转,

To solve the problem I followed the second answer on this link, 为了解决该问题,我在此链接上遵循了第二个答案,

<https://stackoverflow.com/questions/7353789/ios-disable-autorotation-for-a-subview>

But after adding on the window if I am making the view on the window of the full width and height as the self.view I am not being able to see the buttons 但是在添加窗口后,如果我要在全宽和高度的窗口上作为self.view进行查看,则无法看到按钮

Any suggestions how I can bring the buttons visible while adding the window view as full width and height as the view of my view controller. 在将窗口视图添加为我的视图控制器视图的全角和全角时,如何使按钮可见的任何建议。

You will probably have to create a subView of the "full width and height" view that you have created, and put the buttons over there (instead of in self.view). 您可能必须创建一个已创建的“全宽和全高”视图的子视图,然后将按钮放在此处(而不是self.view中)。

Edit: You might also try calling bringSubViewToFront on both buttons. 编辑:您也可以尝试在两个按钮上调用BringSubViewToFront。

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

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