2010-11-18 5 views
1

RootViewController로 제어되는 여러 UIViewController로 응용 프로그램을 구축하고 있습니다. 현재 plist에서 응용 프로그램의 기본값은 LandscapeRight입니다.iPhone : 가로보기 및 세로보기 만있는 응용 프로그램

  1. IntroView (가로 오른쪽 만)
  2. LandscapeView (가로 오른쪽 만)
  3. PortraitView (만 세로)
  4. :

    내가 RootViewController에로드 할 수있는 다음과 같은 파일이 있다고 가정하자

또한 RootViewController의 shouldAutorotateToInterfaceOrientation에 다음을 추가했습니다.

,
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
if ([currentClass class] == PortraitView.class) { 
    return (interfaceOrientation == UIInterfaceOrientationPortrait); 

} else { 
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); 
} 

} 내가 지금 this thread

if (self.interfaceOrientation == UIInterfaceOrientationPortrait) { //UIInterfaceOrientationLandscapeRight) {  

    self.view.transform = CGAffineTransformIdentity; 
    self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(-90)); 
    self.view.bounds = CGRectMake(0.0, 0.0, 320, 480); 
    self.view.center = CGPointMake(240.0f, 160.0f); 

} 


[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait]; 

이 제대로 PortraitView에로드 수익률하지만 내 문제에 다음과 같은 (비슷한을 추가 PortraitView에와 viewWillAppear에로드 할 때까지

그래서 모두가 잘 내 PortraitView 내에서 그 사이에 플립하고 싶습니다 2 subviews있다,하지만 내보기 UIViewAnimationTransitionFlipFromLeft 회전 실제로 있기 때문에 대신 맨 왼쪽에서 오른쪽 맨 위 플립합니다. 나는 내 인생에서 PortraitView에 초상화를 쓰는 방법을 알아낼 수 없다.

[[UIDevice currentDevice] orientation]을 선택하면; 그것은 풍경에 나에게 말한다. shouldAutorotateToInterfaceOrientation을 사용하여 Portrait로 설정하려고하면 내보기가 회전하여 더 이상 올바르지 않습니다.

희망적으로 말이 되네요! 하루 종일이 문제를보고있었습니다.

감사합니다.

+0

RootViewController의 수퍼 클래스는 무엇입니까? 그냥 일반 UIViewController 이니? –

+0

예, UIViewController입니다. 탐색 또는 탭 막대를 사용하지 않습니다. –

답변

0

나는 이것에 약간 달랐다. UIViewController 왼쪽에서 오른쪽 방향이 아닌 위에서 아래 방향을 바꾼 가로 모드의 하위 클래스입니다.

저에게 도움이되는 해결책은 모든 내보기를 하나의 "내부"보기에 추가 한 다음 UIViewController의 보통 view 대신 뒤집으십시오. [self innerView][self view]의 유일한 아이를, 그리고 모든 파단이 그 안에 있습니다

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight 
          forView:[self innerView] 
          cache:YES]; 

.

관련 문제