문제

탭 바 컨트롤러가있는 스토리 보드가 있습니다.장치가 회전하면 다른 화면으로 이동하려고합니다. 즉, 동일한 레이아웃을 옆으로 표시하지 않고 완전히 다른 것을 보여주지 않습니다.

iOS 5에서는 다음 코드를 uitabbarControllerDelegate 에 달성했습니다.

- (BOOL)shouldAutorotateToInterfaceOrientation:      (UIInterfaceOrientation)interfaceOrientation
{
    if(interfaceOrientation == UIInterfaceOrientationLandscapeRight)
    {    
        [self performSegueWithIdentifier: @"toGraph" sender: self];
    }

    return (interfaceOrientation == UIInterfaceOrientationPortrait);

}
.

iOS 6이 메서드는 더 이상 호출되지 않습니다.이 회전 될 때, 장치 이 회전 할 때가 아닌 모든 방법이 모든 방법을 볼 수 있습니다.

미리 감사드립니다.

도움이 되었습니까?

해결책

정말로 나는 view 회전을 찾는 것이 아니라 오히려 장치 회전을 찾고 있었다.uidevice 클래스를 발견 한 후에는 actytateViews 샘플 코드를 사용할 수있었습니다 (문서 주최자의 대안보기 만 검색)하려면 필요한 모든 것을 얻을 수있었습니다.

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.delegate = self;

    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:)
                                                 name:UIDeviceOrientationDidChangeNotification object:nil];

}

- (void)orientationChanged:(NSNotification *)notification
{
    // We must add a delay here, otherwise we'll swap in the new view
    // too quickly and we'll get an animation glitch
    [self performSelector:@selector(showGraphs) withObject:nil afterDelay:0];
}

- (void)showGraphs
{
    UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
    if (UIDeviceOrientationIsLandscape(deviceOrientation) && !isShowingLandscapeView)
    {
        [self performSegueWithIdentifier: @"toGraph" sender: self];
        isShowingLandscapeView = YES;
    }

    else if (deviceOrientation == UIDeviceOrientationPortrait && isShowingLandscapeView)
    {
        [self dismissModalViewControllerAnimated:YES];
        isShowingLandscapeView = NO;
    }
}
.

다른 팁

austorotation이 iOS 6에서 변경되었습니다. 이슈에 대한 Apple Dev 포럼에있는 스레드가 있습니다. https://devforums.apple.com/thread/166544?tstart=30

여기에 몇 가지 스레드가 있습니다. http://www.buzztouch.com/forum/thread.php?tid.= 41ED2FC151397D4AD4A5A60 & CurrentPage= 1

https://www.buzztouch.com/forum/thread. PHP? FID= B35F4D4F5EF6B293A717EB5 & TID= B35F4D4F5EF6B293A717EB5

이들은이 문제에 대한 가장 관련성있는 게시물이 다음과 같은 것으로 보입니다.

탭 탭의 경우 탭 앱의 경우 AppDelegate 에서이 행을 대체했습니다. [self.window addsubview : [self.rootapp.roottabbarcontroller보기]];

다음과 같습니다. [self.window.rootviewController= self.rootapp.RootTabbarController보기];

및 비 탭 앱을 얻으려면이 줄을 대체했습니다. [self.window addsubview : [self.rootapp.rootnavController보기]]]

다음과 같이하십시오. [self.window.rootViewController= self.rootApp.RootNavController보기];

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