기본적으로 TabBar 앱인 앱 (첫 번째 항목) 작업 중입니다. - 로그인보기 컨트롤러 - 탭 막대 컨트롤러 (로그인 완료시) - TabBar의 첫 번째 항목이 세로에서 가로로 전환 될 때 사용되는 가로보기 컨트롤러입니다.아이폰 : 내 가로보기에서 세로보기로 전환 할 수 없습니다.
그래서 첫 번째 탭에있을 때 다른 데이터를 표시하려면 가로보기로 이동할 수 있어야합니다. , 나는 landscapeViewController은 가로 모드에 표시 할
- (void)setSubViewTabBarViewController {
[window addSubview:[tabBarController view]];
}
- (void)setSubViewGraphLandscapeViewController {
[window addSubview:[landscapeViewController view]];
}
: 나는 setSubViewLandscapeViewController과 setSubViewTabBarController을 구현 한 대리인에
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if([self selectedIndex] == 0)
return YES;
return NO;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
// Get AppDelegate
MyAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
// Remove TabBarView and add graph Landscape View
[self.view removeFromSuperview];
[delegate setSubViewLandscapeViewController];
}
}
: 내 탭 표시 줄 컨트롤러에서, 나는 그 방법을 구현 한 나는 (내 landscapeViewController에서) 다음이 : 이것의 일부가 잘 작동
풍경이에
는- (void)viewWillAppear:(BOOL)animated {
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
}
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
NSLog(@"willRotateToInterfaceOrientation");
}
, 나는 세로에서 스위치를 의미 확인 (첫 번째 탭에있을 때), tabbarcontroller는 SuperView에서 제거되고 가로보기는 하위보기로 추가됩니다.
문제는 ... 세로 모드로 전환하는 방법을 알지 못합니다 (이전 컨트롤러를로드 할 때, 내 대의원의 setSubViewTabBarViewController를 사용하여 TabBar를로드하는 방법). 가로보기에서 실제로 장치를 이동할 때 willRotateToOrientation, willRotateFromOrientation ...이 표시되지 않습니다.
요컨대, 내가 가로보기에있을 때 나는 뒤로 이동하는 것을 모릅니다 tabbar보기에 ... 나는 일단이 풍경에 있으면 일종의 가로보기에 갇혀있다.
도와 주셔서 감사합니다 많이
루크 예제 폴더에 CPTestApp 아이폰의 원형 차트에서
안녕하세요, 사실 나는 사실 내가 아닌 것 같아요. 정말 명확 : ( 세로 모드에서 가로 모드로 이동할 때 lanscape 뷰를로드해야했습니다. finanaly는 shouldAutorotateToInterfaceOrientation 및 willRotateToInterfaceOrientation 메소드를 사용하여이를 관리했습니다. 이제 가로 모드입니다. 어떻게 해야할지 모르겠다. 가로 모드에서 세로 모드로 회전을 처리 ... UIView를 가로 방향으로 선언 했으므로이 경우 트리거되는 메서드가 있습니까? 감사합니다. – Luc