当我改变方向时,我会这样做。
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if((self.interfaceOrientation == UIDeviceOrientationPortrait) || (self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown))
{
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"auto_main_hor.png"]]];
[UIView commitAnimations];
} else if((self.interfaceOrientation == UIDeviceOrientationLandscapeLeft) || (self.interfaceOrientation == UIDeviceOrientationLandscapeRight))
{
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"auto_main_vert.png"]]];
}
}当我急剧旋转设备180度时,我得到了一些错误显示?我怎么才能修复它?
发布于 2011-10-28 09:56:28
请注意,UIInterfaceOrientation和UIDeviceOrientation不是一回事。您正在使用设备方向,而您应该使用接口方向。
https://stackoverflow.com/questions/7230410
复制相似问题