나는 보통 UIViewController의 하위 클래스가 있습니다. App을로드 할 때 프로그램 적으로 넣어야하는 요소의 크기를 조정해야합니다. 물론, 크기는 인터페이스의 방향에 따라 달라집니다 그래서 내가 그랬어 :UIViewController interfaceOrientation 문제
- (void)viewDidLoad {
switch([self interfaceOrientation]) {
case UIInterfaceOrientationPortrait:
case UIInterfaceOrientationPortraitUpsideDown:
NSLog(@"Portrait");
break:
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
NSLog(@"Landscape");
break;
}
그러나 시뮬레이터/장치의 방향에 상관없이,이 사건은 모든 것이 제대로 회전 경우에도 항상있는 viewDidLoad/WillAppear의 초상화이다 . Plist에서 지원되는 모든 방향을 추가했습니다. 힌트?
똑같은 문제가 발생했습니다! 이것은 항상 시뮬레이터에서 문제가되었습니다. 가장 좋은 점은 "willRotate"에 침입하면 가로로 회전 할 것이라고 알려줍니다. 다음으로 layoutSubview에서 중단됩니다. 거기서 방향을 확인하면 초상화입니다! WTF? – Krumelur
'shouldAutorotateToInterfaceOrientation'을 재정의하고 거기서'YES'를 돌려 주어야한다는 것이 명백하지 않습니까 ?? 그렇게했다면 코드를 해당 메소드로 이동하십시오. – Mazyod