장치를 회전 할 때 두보기를 전환하는 UIViewController (How to switch views when rotating 기반)를 만들었습니다. 각보기는 특정 방향에 대해 "특수화 된"것입니다. 작동 종류의회전 할 때보기가 바뀌어 움직입니다.
-(void) deviceDidRotate: (NSNotification *) aNotification{
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
NSLog(@"Device rotated to %d!", orientation);
if ((orientation == UIDeviceOrientationPortrait) ||
(orientation == UIDeviceOrientationPortraitUpsideDown)) {
[self displayView:self.portraitViewController.view];
}else if ((orientation == UIDeviceOrientationLandscapeLeft) ||
(orientation == UIDeviceOrientationLandscapeRight)) {
[self displayView:self.landscapeViewController.view];
}
}
과 :
그것은보기를 전환 할 수 UIDeviceOrientationDidChangeNotification 알림을 사용합니다. 가로 방향으로 회전 한 다음 다시 세로 방향으로 회전하면 문제가 나타납니다.
처음 세로 :
회전 풍경에 위로
세로로 되돌아 갈 때 파단은 올바른 장소에 특별히 UIPickerView을 표시되지 않습니다 세로 방향으로 :
회전 과정을 반복하면 상황이 더욱 악화됩니다. 내가 도대체 뭘 잘못하고있는 겁니까?
소스 코드는 여기에 있습니다 : 사전에 http://dl.dropbox.com/u/3978473/forums/Rotator.zip
감사합니다!
제안한대로 displayView : 코드를 변경해 보았지만 작동하지 않았습니다. 어쨌든 고마워. – cfischer