내가 대답을 : 앱 위임에서
- (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape|UIInterfaceOrientationLandscapeRight;
}
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
이 기능을 추가! 내 친구 중 한 명이 나를 도와주었습니다.
뷰는 표시 될 때까지 방향이 지정되지 않으므로 뷰에 구성 요소를 추가하고 기본값 이외의 다른 방향으로 향하게하려는 경우 (세로 인 것으로 의심되는 경우) 해당 구성 요소를 다음 위치에 추가해야합니다. -(void)viewDidAppear:(BOOL)animated
. viewDidLoad
메서드 내에서 뷰에 여러 구성 요소를 추가 한 메서드를 호출했지만 해당 메서드가 호출 될 때 뷰가 나타나지 않고 방향이 설정되지 않았습니다. 내 초기화 코드를 viewDidAppear
방법으로 이동하면 문제가 해결됩니다.
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidLoad];
//Probably dont want to draw stuff in here, but if you did, it would adhere to the
//correct orientation!
CAShapeLayer *layer = [CAShapeLayer layer];
layer.backgroundColor = [UIColor blueColor].CGColor;
layer.anchorPoint = CGPointMake(0, 0);
layer.bounds = CGRectMake(0, 0, self.view.bounds.size.width, 300);
[self.view.layer addSublayer:layer];
//Call methods from here
[self initializeScrollView];
[self addItemToScrollView];
[self addGraphToView];
}
당신이 UISplitViewController를 사용하고 있습니까 : 여기
은 예입니다? – KishoreK아니요. 그냥 UIViewController입니다. – tentmaking