모든 방향을 지원하는 앱이 있지만 일부 버튼을 클릭하면 앱이 현재 방향 만 지원하도록하고 싶습니다. 그렇게하는 방법?버튼을 클릭했을 때 shouldAutorotateToInterfaceOrientation 메서드를 재정의합니다.
0
A
답변
0
장치 방향은 실제로 정수입니다. 당신이 할 수있는 일은 버튼을 클릭했을 때 현재 방향으로 설정 한 로컬 변수를 가지고 오리엔테이션 메서드에서 그 방향만을 반환하는 것입니다. 해당 정수가 설정되지 않은 경우 장치의 방향을 반환하십시오. shouldAutorotateToInterfaceOrientation은 iOS 6.0에서 더 이상 사용되지 않습니다. 문서에서 :
shouldAutorotateToInterfaceOrientation : (Deprecated in iOS 6.0. Override the supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation methods instead.)
편집 : 다음은 UIInterfaceOrientation에 대한 참조입니다.
열거 타입 정의 : {NSInteger UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight, UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft UIInterfaceOrientation};