0

这是我在方向改变时所做的......

-(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 度时,我会出现一些错误显示?我该如何解决?

4

1 回答 1

1

请注意,UIInterfaceOrientationUIDeviceOrientation不是一回事。您正在使用应该使用界面方向的设备方向。

于 2011-10-28T01:56:28.107 回答