2011-10-20 11 views
0

私は正しく自動サイズ設定されていないボタンを持っています。私はそれが風景の左または右の風景のときに右に約100ピクセル以上移動する必要があります。これを行う簡単な方法はありますか?私はjavascriptでそれをする方法を知っていますが、客観的なものではありません。あなたの助けをありがとうiPadの風景でボタンを移動しますか?

答えて

0

あなたのコントローラでは、viewDidLayoutSubviewsメソッドを実装し、あなたの望むようにあなたのビューを配置します。

+0

これはどのようにボタンを移動するのに役立ちますか?その方法の中で – davis

+0

を使用すると、ボタンを配置する位置を決定し、それに応じて設定することができます。 – Scott

+0

このようなもの: 'UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; BOOL inLandscape = orientation == UIInterfaceOrientationLandscapeRight || oritentation == UIInterfaceOrientationLandscapeRight; CGFrameフレーム= CGRectMake(inLandscape?100.0:0、0、myControl.frame.size.width、myControl.frame.size.height); ' などです。 – Scott

0

私はこの操作を次のように行う場合があります。必要に応じてコントロールを移動するコードを挿入します。

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration{ 

    if (self.interfaceOrientation == UIDeviceOrientationPortrait || self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown) 
    { 
    //setup your interface for portrait 
    } 

else 

    if (self.interfaceOrientation == UIDeviceOrientationLandscapeLeft || self.interfaceOrientation == UIDeviceOrientationLandscapeRight) 
    { 
    //setup your interface for landscape 
    // your code to move buttons etc would go here 
    } 
} 
関連する問題