2017-02-27 13 views
0

Xcode 8以前では、次のようなボタンが表示されていました。 w:任意のh:任意のインターフェイスを変更できました。そのインターフェースが選択されている(つまり、Portraitには表示されませんが、Landscapeには表示される)場合にのみ表示されます。 Xcode 8には、グリッドをプルアップするボタンはありませんが、「Vary for Traits」ボタンがありますが、同じ方法で動作するようには見えません。誰にもこのトピックに関するアドバイスやヘルプがありますか?特定のインターフェイスでのみオブジェクトを表示できるように設定する方法

おかげで

答えて

0

あなたは、デバイスの向きの変化に耳を傾け、表示/非応じてボタンを表示する必要があります。

のviewDidLoadでは、これを追加します。

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    [self configureYourButtonForOrientation:[[UIApplication sharedApplication] statusBarOrientation]]; 
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil]; 
} 

が、あなたは現在のステータスバーの向きをやりたいです。あなたにご連絡ください。

- (void)orientationChanged:(NSNotification *)notification{ 
    [self configureYourButtonForOrientation:[[UIApplication sharedApplication] statusBarOrientation]]; 
} 

- (void)configureYourButtonForOrientation:(UIInterfaceOrientation)orientation{ 
    switch (orientation) { 
     case UIInterfaceOrientationLandscapeLeft: 
     case UIInterfaceOrientationLandscapeRight: 
      break; 

     case UIInterfaceOrientationPortrait: 
     case UIInterfaceOrientationPortraitUpsideDown: 
      break; 

     default: 
      break; 
    } 
} 
関連する問題