uitableview を含むメイン ビューがあり、ユーザーが行をタップすると別のビューをプッシュしています。子ビューのみを回転させ、そのためのコードを記述したいと考えています。しかし問題は、ビューをプッシュすると、メイン ビューの向きも有効になることです。
メイン ビューを左に回転すると、ステータス バーも左に変わります。メイン ビューに向きを適用していません。MainView で次のことを行いましたが、コードはまだステータス バーが変わりません。
-(void) viewDidLoad
{
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(receivedRotate:) name: UIDeviceOrientationDidChangeNotification object: nil];
}
-(void) receivedRotate: (NSNotification*) notification
{
UIDeviceOrientation interfaceOrientation = [[UIDevice currentDevice] orientation];
if(interfaceOrientation != UIDeviceOrientationUnknown)
{
if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft)
{
[self shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}
}
}
メイン ビューで interfaceOrientation を無効にするにはどうすればよいですか?