質問

タブバーコントローラを持っているストーリーボードを持っています。デバイスが異なる画面に移動したい場合、すなわち、同じレイアウトを横に見せていないが、完全に異なるものを表示していない。

iOS 5では、UitabbarControllerDelegate の次のコードでこれを実現しました

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

    return (interfaceOrientation == UIInterfaceOrientationPortrait);

}
.

IOS 6では、この方法はも呼ばれなくなりました。 VIEW が回転したときに対処できるすべての方法では、デバイスが回転しているときはわかりません。

事前にありがとうございました。

役に立ちましたか?

解決

だから私は View 回転を探していたが、むしろ装置回転を探していたはずであるべきである。UideViceクラスを発見した後、私が必要なものすべてを取得するために、AlternateViewsのサンプルコード(ドキュメントオーガナイザーでAlternateViewsを検索するだけ)を使用できました。

- (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;
    }
}
.

他のヒント

IOS 6で変更されました。 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