ねえ、私は今自分で回避策を思いつきました。問題の要約 ウィンドウへの最初のアドデット ビューのみが方向の変更を認識します。
私は My TabBarController をサブクラス化し、Rotate to the Interface Orientation にしました
- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self adjustViewsForOrientation:toInterfaceOrientation];
}
- (void) adjustViewsForOrientation:(UIInterfaceOrientation)orientation {
if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
NSLog(@"Landscape");
//Do Your Landscape Changes here
}
else if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
NSLog(@"Portrait");
//Do Your Portrait Changes here
}
}
しかし、私のTabBarControllerの「viewControllers」はまだInterfaceOrientationsを認識しません。だから私は次のことを思いついた:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
for (int i = 0; i < [self.viewControllers count]; i++ ) {
[[self.viewControllers objectAtIndex:i] didRotateFromInterfaceOrientation:fromInterfaceOrientation];
}
}
これにより、TabBarController のすべてのサブクラスから didRotateFromInterfaceOrientation メソッドが呼び出されます。
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
[self adjustViewsForOrientation:self.interfaceOrientation];
}
- (void) adjustViewsForOrientation:(UIInterfaceOrientation)orientation {
if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
NSLog(@"Subview Landscape");
//Do Your Landscape Changes here
}
else if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
NSLog(@"Subview Portrait");
//Do Your Portrait Changes here
}
}
ご覧[self adjustViewsForOrientation:self.interfaceOrientation];
のとおり、調整メソッドに実際の向きを与えるサブビューコントローラーを呼び出します。fromInterfaceOrientation を使用すると、変更が既に行われているため、誤った方向になります。
私の他の問題は、TabBarController の UISplitviewController でしたが、許容できる方法で動作していませんでした。問題は UIViewControllers の場合と同じです。Orientation Changes を認識しないので、サブクラス化する必要がありますが、100% までは機能しませんでした。Web を検索したところ、cutsom ビルド Splitview の適切なコード例が見つかりました。試してみてください:
http://blog.trustedones.com/development/ipad-uisplitviewcontroller-replacement-for-sethidesmasterviewinportrait
http://www.trustedones.com/apps/ipad
また、SplitView をポートレート モードに保つので、気に入っていただけると思います。そうです!
この投稿で誰かを助けることができれば幸いです.. Cheers nettz