iOS 5 및 iOS 6을 대상으로하는 앱을 만들었으며 어떤 이유로 iOS 6이 장착 된 기기에서 사용할 때만 회전합니다. iOS 5를 사용하는 기기에서는 회전하지 않습니다. 내 앱은 범용입니다. 이 문제를 해결하도록 도와주세요! 감사합니다.앱이 iOS 6에서만 회전하고 iOS 5에서는 회전하지 않습니다.
답변
iOS 5 및 iOS 6은 다른 방향 및 회전 위임자를 호출합니다. 에서 iOS 5에서 구현 : 아이폰 OS 6, 6
그래서 아이폰 OS에서 더 이상 사용되지 않습니다
shouldAutorotateToInterfaceOrientation :를, 당신이 루트 뷰 컨트롤러를 설정하고 구현해야합니다 :
shouldAutorotate :, supportedInterfaceOrientations을 및 supportedInterfaceOrientationsForWindow :
비슷한 문제가있었습니다. 당신은이 질문의 답변을 확인할 수 있습니다
Rotation behaving differently on iOS6
가 자동 회전이 완전히에서 iOS 5 및 iOS 6, 또한 처리 PortraitUpsideDown 방향으로 작동하도록, 요약하기를, 나는 사용자 지정은 UINavigationController를 구현에 할당했다 응용 프로그램의 self.window.rootViewController
은 didFinishLaunchingWithOptions
메서드를 위임합니다.
shouldAutorotateToInterfaceOrientation은 ios6에서 사용되지 않습니다. 당신이 두 OS 버전에 응용 프로그램을 실행하는 wnat 경우
그럼 너무으로는 모두의 UIViewController 서브 클래스에서
//for ios6
- (BOOL)shouldAutorotate {
UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
if (orientation == UIInterfaceOrientationLandscapeLeft ||orientation == UIInterfaceOrientationLandscapeRight)
{
return YES;
}
return NO;
}
//for ios5
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
//interfaceOrientation == UIInterfaceOrientationLandscapeRight;
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
return YES;
}
return NO;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return ((toInterfaceOrientation == UIInterfaceOrientationPortrait) || (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown));
}
- (NSUInteger)supportedInterfaceOrientations
{
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
}
오버라이드 (override)하는 두 가지 방법을 다음과 shouldAutorotateToInterfaceOrientation를 추가 ......이 작동됩니다 ios6 및 이전 버전
ios5 및 ios6에서 자동 실행을 지원하려면 ios6의 경우 콜백을 제공해야합니다. [[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];
우리는 iOS5를
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{ 리턴 ((toInterfaceOrientation == UIInterfaceOrientationPortrait)에 대한
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
-(BOOL)shouldAutoRotate{
return YES;
}
를 호출 할 필요가 || (toInt erfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)); }
흠 ... 이미 포맷하지 않았습니까? 아니, 그것은 또 다른 사본이었습니다 : 그래서 여러 질문에 똑같은 답변을 게시하지 마십시오. 모든 사람에게 적합하지 않거나 질문이 중복되어 표시되어야합니다. – kleopatra
- 1. iOS 5에서는 EKAlarm이 설정되지 않습니다
- 2. IOS - UIViewController가 회전하지 않습니다
- 3. 동영상 업로드는 iOS 4에서 작동하지만 iOS 5에서는 작동하지 않습니다.
- 4. iOS : 동영상 플레이어보기가 회전하지 않습니다.
- 5. 코드 조각은 iOS 6에서 작동하지만 iOS 5에서는 작동하지 않습니다.
- 6. iOS : 유니버설 앱이 회전하지 않으며 willRotateToInterfaceOrientation을 호출하지 않습니다.
- 7. iPhone : iOS 5.0에서 MPMoviePlayerController가 회전하지 않습니다.
- 8. 오리엔테이션 iOS 스토리 보드가 회전하지 않습니까?
- 9. iOS 6의 스플래시 화면에서 iPod touch/iPhone 앱이 멈추지 만 iOS 5에서는 정상적으로 작동합니다.
- 10. 애플 리케이션은 iOS 4.3에서는 잘 작동하지만 iOS 5에서는 충돌이 발생합니다.
- 11. UIMenuController는 iOS 4에는 표시되지 않지만 iOS 5에서는 작동합니다.
- 12. IOSView 4.3에서는 PresentViewController가 작동하지만 iOS 5에서는 작동하지 않습니다
- 13. 앱이 iOS 5.0 시뮬레이터에서 충돌하지만 iOS 6.0에서는 오류가 발생하지 않습니다.
- 14. iOS 앵커 포인트를 중심으로 뷰를 회전하고 터치합니다.
- 15. iOS : CGImage를 회전하고 UIImage로 회전시키는 방법은 무엇입니까?
- 16. iOS 4에서는 흔들림 인식 기능이 작동하지 않고 iOS 5에서는 작동하지 않습니다.
- 17. UIWebview가있는 IP 카메라 스트림은 IOS 5에서는 작동하지만 IOS 6에서는 작동하지 않습니다.
- 18. iPhone : 코어 데이터 예제가 ios 6 시뮬레이터에서 작동하지만 iOS 5에서는 작동하지 않습니다.
- 19. 다른 시뮬레이터 iOS 버전에서 앱이 표시되지 않습니다
- 20. iOS : 설정에서 알림 센터에 앱이 나타나지 않습니다.
- 21. iOS 4.1에서 iPhone 앱이 작동하지 않습니다.
- 22. iOS 앱이 다른 언어로 작동하지 않습니다.
- 23. iOS 4.2에서 앱이 실행되지 않습니다. 아키텍처 문제
- 24. iOS 앱이 새면 있습니다.
- 25. iOS-6에서만 가로 방향을 지원하는 앱에서 UIImagePickerController를 사용하는 방법은 무엇입니까?
- 26. stringByEvaluatingJavaScriptFromString이 iOS 6에서 작동하지 않습니다.
- 27. iOS 앱이 모든 캘린더에서 작동해야합니다.
- 28. UIWebView로 인해 iOS 앱이 거부되었습니다.
- 29. iOS 시뮬레이터 앱이 시작되지 않음
- 30. 보기가 올바르게 회전하지 않습니다.
참고 :이 예제는 '직립'(세로)과 '거꾸로'(세로 위 쪽) 두 가지 상태 만 지원합니다. – Gonen