Странное поведение при изменении UIDeviceOrientation - PullRequest
0 голосов
/ 29 августа 2011

Вот что я делаю, когда меняю ориентацию ...

-(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 градусов, я получаю неправильное отображение?как я могу это исправить?

1 Ответ

1 голос
/ 28 октября 2011

Обратите внимание, что UIInterfaceOrientation и UIDeviceOrientation - это не одно и то же. Вы используете ориентацию устройства там, где вы должны использовать ориентацию интерфейса.

...