![](/img/trans.png)
[英]UIView animateWithDuration not changing the frame of UIView
[英]UIView frame changing coordinates in iPad app
强文本我有一个iPad应用程序,仅允许横向显示,并以横向启动。 我有一个UIViewController
并在viewDidLoad
设置视图的框架:
self.view.frame = CGRectMake(0, 0, 1024, 728);
在同一UIViewController
的touchesBegan
函数中,我打印出视图:
NSLog(@"%@",self.view);
当我点击屏幕时得到:
<UIView: 0x37e370; frame = (0 0; 768 1024); transform = [0, 1, -1, 0, 0, 0]; layer = <CALayer: 0x37e3d0>>
如您所见,帧更改为[0,0,768,1024](这是纵向iPad),而不是[0,0,1024,728](这是我在viewDidLoad
方法中定义的内容)。
为什么打开我的电源?
这与您的另一个问题有关,不是吗? iPad Landscape开始混乱
引用答案:“是,在定义UIWindow时,需要将其定义为
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
而不是严格的坐标。 ”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.