【发布时间】:2013-01-15 05:22:57
【问题描述】:
我在viewWillAppear函数中有如下代码:
CAGradientLayer *bgLayer = [BackgroundLayer yellowGradient];
[bgLayer setBounds:self.view.bounds];
[self.view.layer insertSublayer:bgLayer atIndex:0];
它在纵向上完美运行。但是,当设备进入横向模式时,它会在侧面产生白色(或默认颜色)背景。我已经看到了为什么会发生这种情况的其他示例,但没有关于如何解决它。
我看到的情况是横向 (iPad) 上的 1024 分辨率降至 1004,我认为它正在将其调整为 0,20 x, y。
有没有其他人遇到过这个问题并找到了解决方法?
【问题讨论】:
-
您是否正确设置了视图的 autoresizingMask 属性?
标签: ios background