2
가로를 회전 할 때 모달 뷰 컨트롤러가 표시됩니다. 제가 초상화에있을 때 모달보기 컨트롤러를 제거하고 싶습니다. 어떤 이유로 인물 모드로 들어가면 내 로그 문이 표시되지 않습니다.iPhone에서 세로 방향을 감지 할 수 없습니다.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
return (interfaceOrientation == UIInterfaceOrientationPortrait ||
interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown ||
interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
NSLog(@"showing chart");
[self presentModalViewController:landscapeChartViewController animated:NO];
}
if (toInterfaceOrientation == UIInterfaceOrientationPortrait ||
toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
NSLog(@"dismissing chart");
[self.parentViewController dismissModalViewControllerAnimated:NO];
}
}
코드가 훨씬 깔끔하고 논리가 정확합니다. 무리 감사. –