보기 제어기 A는보기 제어기 B를 가로 방향으로 표시합니다.세로 회전 후 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는 가로 방향으로 나타납니다. 다음은보기 제어기 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가 가로 방향으로 고정되어 있다는 것입니다. 이 문제를 어떻게 해결할 수 있습니까?
당신은 제대로 내 문제를 이해합니다. 불행하게도,이 코드를 구현할 때 세로보기 모드로 회전 할 때보기 컨트롤러 B가 닫히지 않습니다. –
제발, 제 편집을 참조하십시오. – sergio
제대로 작동하지 않습니다. View Controller B는 세로 모드로 회전 할 때 해제되지 않습니다. –