【发布时间】:2011-11-12 20:40:56
【问题描述】:
当 iPad 方向改变时,我正在使用以下代码来改变 UIImageView 的图像
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
if((self.interfaceOrientation == UIDeviceOrientationLandscapeLeft) || (self.interfaceOrientation == UIDeviceOrientationLandscapeRight))
{
self.background=self.background_D;
self.backgroundImage.backgroundColor = [UIColor colorWithPatternImage:self.background];
}
else if((self.interfaceOrientation == UIDeviceOrientationPortrait) || (self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown))
{
self.background=self.background_P;
self.backgroundImage.backgroundColor = [UIColor colorWithPatternImage:self.background];
}
}
一切正常,除了当我改变方向时它需要暂停一秒钟然后改变图像。同时它以平铺格式显示相同的旧图像。我应该怎么做才能避免这种情况?
提交
【问题讨论】:
标签: ipad uiimageview uiimage interface-orientation uideviceorientation