스토리 보드에 5 개의보기가 있습니다. 각보기의 방향이 달라지기를 원한다면 하나의보기가 UIInterfaceOrientationLandscapeRight
이고 다른보기는 UIInterfaceOrientationLandscapeLeft
또는 UIInterfaceOrientationPortrait
또는 UIInterfaceOrientationPortraitUpsideDown
이됩니다. 그렇다면이 방향성을 어떻게 다르게 설정해야할까요?런타임시 UIInterfaceOrientation을 설정하십시오.
나는 [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
을 사용하고 있지만 경고 'UIDevice이 setOrientation에 응답하지 않을 수 있습니다'을 보여줍니다. 많은 사용 stackoverflow 작가에 따르면
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
//return UIInterfaceOrientationLandscapeLeft;
return (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}
위의 코드가 있지만 내 프로젝트에서 작동하지 않습니다. 화면의 방향을 결정하는 적절한 절차는 무엇입니까? 미리 감사드립니다.
내 장치를 프로그래밍 방식으로 세로 모드로 유지할 수있는 방법이 있습니까? – Banshidhari
세로 방향의 경우 shouldAutorotateToInterfaceOrientation에서 반환을 유지합니다. – beryllium