【问题标题】:UIView frame changing coordinates in iPad appiPad应用程序中的UIView框架更改坐标
【发布时间】:2012-02-13 01:03:56
【问题描述】:

strong text我有一个 iPad 应用程序,它只允许横向方向,并以横向方向启动。我有一个UIViewController 并在viewDidLoad 中设置了视图的框架:

self.view.frame = CGRectMake(0, 0, 1024, 728);

在同一 UIViewControllertouchesBegan 函数中,我打印出视图:

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 中将其定义为方法)。

为什么它会打开我?

【问题讨论】:

    标签: ios ipad uiview uiviewcontroller


    【解决方案1】:

    这与您的另一个问题有关,不是吗? iPad Landscape messing up touches began

    引用你的答案: "就是,在定义UIWindow的时候,需要定义为

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    

    而不是严格的坐标。 "

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-26
      • 1970-01-01
      • 2019-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-14
      相关资源
      最近更新 更多