2011-09-17 6 views
0

iPhone의 표준 iPod 응용 프로그램과 비슷한 효과를내는 올바른 방법은 무엇입니까? 장치를 가로 모드로 돌리면보기가 흐름을 덮지 만, 전환 유형이 희미 해지고 회전 화면이 아닙니다.회전 애니메이션없이 IOS 회전 장치

이 내가 모달 뷰를로드하고 방법입니다

- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { 
    if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) { 
     carouselView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
     [self presentModalViewController:carouselView animated:YES]; 
    } 
} 

감사합니다!

안드리

답변

2

나중에는이 솔루션을 사용하는 것이 더 안정적인 것으로 나타났습니다 :

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:@"UIDeviceOrientationDidChangeNotification" object:nil]; 
:의 viewDidLoad 방법이 추가 (이 탭보기 컨트롤러 인 내 경우) 부모 뷰 컨트롤러에서

다음이 방법을 추가

- (void) didRotate:(NSNotification *)notification {  

    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; 
    if (UIInterfaceOrientationIsLandscape(orientation) && !self.modalViewController) { 
     [self presentModalViewController:carouselView animated:YES]; 
     [Globals sharedGlobals].startedAtLandscape = YES; 
    } 

    if (UIInterfaceOrientationIsPortrait(orientation) && self.modalViewController) { 
     [self dismissModalViewControllerAnimated:YES];  
     [Globals sharedGlobals].startedAtLandscape = NO; 
    } 
} 

그리고 마지막 경우를 회전 애니메이션을 방지하려면 다음과 같이이 메서드를 수정하십시오.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    if(UIInterfaceOrientationIsLandscape(interfaceOrientation)) { 
     return NO; 
    } 
    return YES; 
} 
+0

presentModalViewController는 더 이상 사용되지 않습니다. –