我正在使用以下代码在 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];
}
}
一切正常,除了当我改变方向时它需要暂停一秒钟然后改变图像。同时它以平铺格式显示相同的旧图像。我应该怎么做才能避免这种情况?
苏米特