문제

나는 앱에서 일하고있다. 앱의 방향은 조경이지만 앱의 인터페이스 방향이 앱의 인터페이스 방향이 인터페이스를 변경하고 회전합니다. 올바른 방식으로 스플래시 화면 디스플레이 (풍경). iOS7을 사용하고 있습니다. 앱은 iOS5 용 코드였습니다. IOS5의 더 이상 사용할 수 없기 때문에 whildAutorotateTointerfaceorientation 봇이 더 이상 사용되지 않는 API 문제가 있다고 생각합니다.

enter image description here

도움이 되었습니까?

해결책

모든 내비게이션 컨트롤러가 상단 뷰 컨트롤러를 존중하려면 카테고리를 사용할 수 있으므로 클래스 이름을 변경하지 않아도됩니다.

 @implementation UINavigationController (Rotation_IOS6)

-(BOOL)shouldAutorotate
{
   return [[self.viewControllers lastObject] shouldAutorotate];
 } 

-(NSUInteger)supportedInterfaceOrientations
{
    return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return [[self.viewControllers lastObject]     preferredInterfaceOrientationForPresentation];
}

@end

몇 가지 의견에 따르면, 이것은 문제에 대한 빠른 해결책입니다. 더 나은 솔루션은 서브 클래스 UinavigationController이며 이러한 방법을 여기에 두는 것입니다. 서브 클래스는 또한 6과 7을지지하는 데 도움이됩니다.

다른 팁

enter image description here

Build Seeting에서 Orintatoin을 설정해야합니다.

그것은 당신의 문제를 해결할 것입니다.

이 시도:

- (BOOL)shouldAutorotate
{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
}

편집하다 :

첨부 된 것을 참조하십시오 링크, 당신에게 도움이 될 수 있습니다.

나는 내가하는 생각이 해결책을 찾습니다. 1 단계 카테고리를 만들어 UinavigationController를 무시합니다

2 단계 대체 [self.window addsubview : [NavigationController View]]; //낡은

self.window setRootViewController : NavigationController]; //새로운

이것을 appdelegate.m에서 사용하십시오

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    NSLog(@"Interface orientations");
    if([[UIDevice currentDevice]userInterfaceIdiom]==UIUserInterfaceIdiomPad ){

        return UIInterfaceOrientationMaskLandScape;
    }
    else{
        return UIInterfaceOrientationMaskPortrait;
    }
}

그것은 나를 도왔다 ..

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