如何在iOS中更改[UIApplication sharedApplication].窗口方向以及设备



在我的应用程序中,我想将UIview添加为AppDelegate.Window上的子视图。UIView 帧为 (0,0,1024,768)。在窗口上添加视图后,它仅覆盖屏幕的一半。

我理解的是视图尺寸是屏幕横向尺寸。窗口处于纵向模式。

只需尝试提供动态宽度和高度,而不是通过 1024 和 768 修复它。你可以传递,比如AppDelegate.Window.bounds.width和AppDelegate.Window.bounds.height。

喜欢。

 CGRectMake (0,0,UIScreen.mainScreen.bounds.size.width, UIScreen.mainScreen.bounds.size.height);

最新更新