0
세로 화면에서 가로 화면 호출 코드를 작성하려고합니다. 현재 화면 방향이 가로 인 경우 아무런 자동 회전도 허용되지 않습니다.자동 회전을 비활성화하는 방법은 무엇입니까?
나는 다음 코드를 시도했다 :
// Override to allow orientations other than the default portrait orientation.
/*- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}*/
- (void)viewDidLoad {
[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(degreesToRadian(90));
landscapeTransform = CGAffineTransformTranslate(landscapeTransform, +90.0, +90.0);
[self.view setTransform:landscapeTransform];
}
그러나 위의 코드
이 UIInterfaceOrientationLandscapeRight을 허용한다.자동 회전을 비활성화하는 방법은 무엇입니까?
미리 감사드립니다.
감사 : 당신의 코드는 같은 모양해야합니다. 이전 버전에서 더 좋았습니다. 그러나 가로 모드에서 세로 모드를 허용합니다. 나는 어떤 방향이 될 수 없도록하려고 노력하고있다. 주기는 다음과 같습니다. 시작 -> 세로 -> 가로 -> 끝. – Ferdinand