Я почти уверен, что вижу, как это должно работать, но мне так же любопытно, почему.Когда я поворачиваю iPhone в симуляторе, метод (см. Ниже), который позволяет ориентацию, вызывается дважды при каждом вращении.Для этого есть причина?
-(BOOL)shouldAutorotateToInterfaceOrientation:interfaceOrientation
EDIT_001
Это то, что вызывается, когда iPhone обнаруживает поворот, мне просто любопытно, что каждый раз, когда я выполняю поворот в симуляторе, операторы NSLog печатаются дважды (т.е.метод вызывается дважды)
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
BOOL autoRotate = NO;
switch(interfaceOrientation) {
case UIInterfaceOrientationPortrait:
NSLog(@"Orientation(%d): Portrait Supported", interfaceOrientation);
autoRotate = YES;
break;
case UIInterfaceOrientationPortraitUpsideDown:
NSLog(@"Orientation(%d): UpsideDown unsupported", interfaceOrientation);
autoRotate = NO;
break;
case UIInterfaceOrientationLandscapeLeft:
NSLog(@"Device: RIGHT, Interface: LEFT(%d)", interfaceOrientation);
autoRotate = YES;
break;
case UIInterfaceOrientationLandscapeRight:
NSLog(@"Device: LEFT, Interface: RIGHT(%d)", interfaceOrientation);
autoRotate = YES;
break;
}
return(autoRotate);
}
Гари