【发布时间】:2014-04-03 11:59:23
【问题描述】:
- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
if ((fromInterfaceOrientation == UIInterfaceOrientationPortrait) || (fromInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)) {
self.view.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"bgImage.png"]];
}
else
{
self.view.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"bgImage1.png"]];
}
}
当设备面向横向或纵向时,我使用上面的代码设置self.view.backgroundColor 图像。图像正确更改。
问题:
当我尝试旋转设备时,图像并没有快速改变,我的意思是改变图像需要 2 到 3 秒。
如何根据横向或纵向设置首次
self.view.backgroundColor图像。
【问题讨论】:
-
做个猜测:尝试使用 -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 而不是 didRotate 让我知道它是否有效 :)
-
使用我的所有三种方法,你得到了解决方案
标签: ios objective-c orientation autolayout