简体   繁体   English

视图控制器上的视图在 Xcode 11 上都是方形的,如何?

[英]View on View controllers are all square shaped on Xcode 11, how?

视图控制器上的视图是方形的

I have tried to change it's size manually (by dragging) and still not working.我试图手动(通过拖动)更改它的大小,但仍然无法正常工作。

您可以将其内容大小设置为任何您想要的大小。

On iOS 13 a "Modal" segue will show the presenting controller that way by default.在 iOS 13 上,默认情况下,“模态”转场会以这种方式显示呈现控制器。

If you want the view controller to occupy the whole screen, set "Full Screen" on the "presentation" setting of any segue entering that controller.如果您希望视图控制器占据整个屏幕,请在进入该控制器的任何 segue 的“演示”设置上设置“全屏”。 Segue Settings转场设置

If your view presents programmatically (not via storyBoard), have this in mind: From XCode 11 and up, when you build for iPad you have to add "modalPresentationStyle = .fullScreen" to get full screen views, not square ones.如果您的视图以编程方式呈现(不是通过 storyBoard),请记住这一点:从 XCode 11 及更高版本开始,当您为 iPad 构建时,您必须添加“modalPresentationStyle = .fullScreen”以获得全屏视图,而不是方形视图。 As follows:如下:

let vc = UIViewController()
vc.modalPresentationStyle = .fullScreen 
self.present(vc, animated: true, completion: nil)

If you want transparency on the new viewController, you can write ".overFullScreen", as follows:如果你想在新的 viewController 上透明,你可以写“.overFullScreen”,如下:

let vc = UIViewController()
vc.modalPresentationStyle = .overFullScreen 
self.present(vc, animated: true, completion: nil)

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

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