문제

내 응용 프로그램은 매우 간단하지만 시작할 때 문제가 있습니다. 나는 info.plist를 조경하도록 설정했지만 순서를 무시하는 것 같습니다. 실제로 앱이로드되면 시뮬레이터가 조경되지만 초상화 모드로 돌아갑니다.

이것은보기와 컨트롤러의 계층입니다.

  • MainViewController (whildAutorotateTointerfaceorientation을 무시하기 위해 UITABBARCONTROLLER를 확장합니다 :)
    • 3 개의 확장 된 UitableViewControllers (탭으로서도 whildAutorotateTointerfaceorientation이 올바르게 설정되어 있음).

내가 장치의 방향을 다음과 함께 조경으로 강요한다면 :

[uidevice currentDevice] setorientation : uiinterfaceorientationlandscaperight];

그런 다음 순간적으로 시뮬레이터는 인물 모드에서 깜박이고 조경됩니다. 문제는 이런 식으로 자동 회전 애니메이션이 시작되었다는 것입니다. 고정 된 조경 된 응용 프로그램 만 원합니다.

단서가 있습니까? 내가 뭔가를 놓치고 있습니까?

도움이 되었습니까?

해결책

다음을 시도하십시오. 왜 그것이 당신에게 효과가 없는지 잘 모르겠습니다

1) 키 Uiinterfaceorientation을 설정하십시오
.plist 파일의 uiinterfaceorientationlandscaperight에

2) UITABBARCONTROLLER DUSTAUTOROTETONTOINTEROINTATION () 메소드를 무시합니다. 다음에서 코드는 Tab Zero 및 1 만 처리하며 하나의 컨트롤러 만 처리합니다. 탐색 컨트롤러가 있고 스택에있을 수있는 다른 컨트롤러를 제어하려면 코드를 그에 따라 수정해야합니다.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    BOOL tabZeroController = [[[self.viewControllers objectAtIndex:0] visibleViewController] isKindOfClass:[YourTabZeroTableViewController class]];

    BOOL tabOneController = [[[self.viewControllers objectAtIndex:1] visibleViewController] isKindOfClass:[YourTabOneTableViewController class]];


    if(self.selectedIndex == 0 && tabZeroController)
        return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);

    if(self.selectedIndex == 1 && tabOneController)
        return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);

    return NO;

}

2) 설정

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];

Delegate의 Application didFinishLaunching () 메소드에서 장치가 아닌 시뮬레이터에만 필요합니다.

3) 컨트롤러에 다음 thistAutorotateTointerfaceorientation (메소드)을 추가하십시오.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
   return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

4) 장치에서 앱을 실행하고 하드웨어 메뉴 항목을 사용하여 왼쪽으로 회전하고 오른쪽으로 회전하여 올바르게 작동하는지 확인하십시오. 조경 모드에서 디스플레이가 표시되어야합니다.

다른 팁

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top