2012-12-01 3 views
0

나는이 :자동 회전 문제

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
return YES; 

} 내 모든 뷰 컨트롤러에서

, 응용 프로그램 요약에 모든 회전이 선택의 Info.plist 파일에있는 모든 회전이 지원되는 키에 추가됩니다. 심지어 가지고있어 :

내가보기를 사용하지 않기 때문에 모든보기 컨트롤러에 추가했습니다.

여기가 이상해집니다. iPad에서 응용 프로그램을 열기 전에 장치가 가로로 놓여 있으면 응용 프로그램을 열고 응용 프로그램을 닫고 응용 프로그램을 강제 종료 할 때까지 가로로 회전하는 하위보기를로드하십시오. 나는 애플 리케이션을 삭제하고 재건을 시도했지만 여러 물리적 장치에서 시도했지만 여전히 변경되지 않았습니다. 나는 심지어 shouldLoguto 메소드에 NSLog 호출을 추가했는데 결코 호출되지 않습니다. 나는 심지어 더미 네그 컨트롤러로 UINavigationController를 서브 클래 싱하고 더미 클래스에 shouldAutoRotate 메소드를 추가하려고 시도했다.

마지막으로 가로로 설정하면 상태 표시 줄 만 가로 방향으로 표시되지만 나머지보기는 표준 세로로 표시됩니다.

어디서 진단해야할까요? 당신이 통증이있을 것입니다 사과의 기본 ViewControllers에서 조금 다른 아무것도 할 싶다면

+1

iOS 6를 실행하고 계십니까? 또한,'AppDelegate'의'didFinishLaunchingWithOptions' 메소드에'self.window.rootViewController'를 설정 했습니까? – neilvillareal

+0

우승자 우승자 닭고기 만찬. 고맙습니다. 요약 탭에 rootviewcontroller가 설정되어 있었지만, 이유를 불문하고 대리인에게 수동으로 입력하는 작업이있었습니다. –

+0

요약 탭에 루트보기 컨트롤러가 있습니까? 나는 거기 있다고 생각하지 않는다. :) 당신이 괜찮 으면, 나는 당신이 받아 들일 수있는 대답으로 내 의견을 게시했습니다. :) – neilvillareal

답변

1

당신이 당신의 AppDelegatedidFinishLaunchingWithOptions에서 self.window.rootViewController를 설정하면 사과 기본값 방법과 올바른 플래그 모든 것을 설정하는 것보다 많은 시간을 절약 할 날 믿어? iOS 5 이하 버전에서는 rootViewController을 설정하지 않아도 앱이 올바르게 회전하지만 iOS 6에서는 설정해야 함을 알았습니다.

자동 회전이 변경되었을 수 있습니다 (약간?) 하나의 방법 (shouldAutorotateToInterfaceOrientation) 대신에 자동 회전 동작을위한 두 가지 방법 (shouldAutorotatesupportedInterfaceOrientations)이 있습니다.

0

자동 아이폰 OS의 새로운 버전은 매우 성가신 회전, 그래서 당신이 사용하는 것이 좋습니다 :

- (void)viewDidAppear:(BOOL)animated { 

UIDevice *device = [UIDevice currentDevice];     //Get the device object 
[device beginGeneratingDeviceOrientationNotifications];   //Tell it to start monitoring the accelerometer for orientation 
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; //Get the notification centre for the app 
[nc addObserver:self           //Add yourself as an observer 
     selector:@selector(orientationChanged:) 
      name:UIDeviceOrientationDidChangeNotification 
     object:device]; 



} 

- (void)viewWillDisappear:(BOOL)animated { 

[[NSNotificationCenter defaultCenter] removeObserver:self]; 

} 

과 만들기 애니메이션 자기를

- (void)orientationChanged:(UINotifiacion*)notification { 

UIDevice *device = (UIDevice *)[notification object]; 
if (UIInterfaceOrientationIsLandscape([device orientation])) { 
    [UIView animateWithDuration:0.4 animations:^{ 
    self.view.transform = CATransform3DMakeRotation(M_2_PI, 0, 0, 1); 
     }]; 

    } 

} 
+0

팁을 주셔서 감사합니다. 마지막 메서드를 추가하면이 오류가 발생합니다 : 'CGAffineTransform'(일명 'struct CGAffineTransform')과 호환되지 않는 유형 'CATransform3D'(일명 'CATransform3D struct')로 지정 –