ビューコントローラAはのUIViewControllerは肖像回転
#pragma mark Rotation Delegate Methods
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
return YES;
}
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
[landscapeChartViewController.chartImageView reloadWithUrl:
[NSString stringWithFormat:@"someurl",[symbol uppercaseString]]];
NSLog(@"showing chart");
[self presentModalViewController:landscapeChartViewController animated:NO];
}
}
水平方向にビューコントローラBを表示した後、これが正常に動作水平方向に立ち往生。 View Controller Bは、横向きに表示されます。ここでビューコントローラBの実装です:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return YES;
}
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {
NSLog(@"dismissing chart");
[self.parentViewController dismissModalViewControllerAnimated:NO];
}
}
問題は、私はビューコントローラAを表示するために戻って縦方向に行くときに、ビューコントローラAは横向きで立ち往生している、です。これをどうすれば解決できますか?
....それが正常に動作します私のコードの一部です。残念ながら、このコードを実装すると、View Controller Bはポートレートモードに切り替えるときに解除されません。 –
私の編集をご覧ください。 – sergio
これも正しく動作しません。 View Controller Bは、ポートレートモードに切り替えるときに解除されません。 –