ビューのすべての内容を整列させる方法。私は回転しているときに、iPadのコンテンツは、この問題を解決する方法自己それを中心に整列されていないのですか?UIView - UIViewのすべてのコンテンツを中央揃えにしますか?
ありがとうございました!
ビューのすべての内容を整列させる方法。私は回転しているときに、iPadのコンテンツは、この問題を解決する方法自己それを中心に整列されていないのですか?UIView - UIViewのすべてのコンテンツを中央揃えにしますか?
ありがとうございました!
didRotateFromInterfaceOrientation
方法とセンターのすべてのサブビューの実装を提供します あなたはこれのように試すことができます。
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
for(UIView *subview in [self.view subviews]) {
subview.center = self.view.center;
}
}
風景モードとポートレートモードの両方についてコンテンツのフレームをプログラム的に変更する必要があります。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight){
// set contents' frame for landscape
}
else {
// set contents' frame for portrait
}
return YES;
}
nibファイルを使用しているのですか、それともプログラムで追加しますか? – shannoga
これはnibファイルを使用しています。私はこれのためのアライメントプロパティがあることを知っているが、これを設定することによって、私はまだ回転後も同じ問題に直面している。 –