【问题标题】:Squashed and distorted view after device rotation设备旋转后视图被压扁和扭曲
【发布时间】:2012-07-10 15:31:35
【问题描述】:

我已经阅读这些页面有一段时间了,但在正确加载我的 CGRect 时遇到了一些问题。我了解到这是因为我在 viewDidLoad 运行后强制定向,并且我试图让 CGRect 之后再次绘制。基本上,这就是我正在查看的内容:

-(void)viewDidLoad
{
    //mybutton.frame = CGRectMake(...);
    //...
}

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

当视图出现时,CGRect 非常挤压和扭曲,因为视图的旋转。

【问题讨论】:

    标签: objective-c ios xcode uiinterfaceorientation cgrect


    【解决方案1】:

    您可以将绘图代码从 viewDidLoad 中提取出来并放入它自己的函数中。然后,您可以从 shouldAutorotateToInterfaceOrientation 和 viewDidLoad 中调用该函数。

    【讨论】:

      猜你喜欢
      • 2011-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      • 2013-05-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多