2011-08-29 41 views
0

在這裏奇怪的現象是,當我的方向改變我做什麼...改變UIDeviceOrientation

-(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度旋轉裝置,我嚴厲地得到一些misdisplaying?我該如何解決它?

+0

你能否詳細說明'misdisplaying'? –

回答

1

請注意UIInterfaceOrientationUIDeviceOrientation不是一回事。您在使用界面方向的位置使用設備方向。