2011-04-29 4 views
4

두 개의 간단한 UIViewControllers가 있고 뷰의 상태 막대는 320 x 460입니다. 나는 푸른 색으로 가득UIView에 UIView에 하위 뷰 (rootViewController 속성을 통해)를 추가하고 플립 할 때 뷰가 "점프"됩니다.

- (IBAction) switchToVerySimpleController 
{ 
    [UIView transitionWithView: [[UIApplication sharedApplication] keyWindow] 
        duration: 0.5 
        options: UIViewAnimationOptionTransitionFlipFromLeft 
        animations:^{ [[UIApplication sharedApplication] keyWindow].rootViewController = [[[VerySimpleController alloc] init] autorelease]; } 
        completion: NULL]; 
} 

새로운 전망을하는 버튼 (VerySimpleController.view)가 SimpleController에서

self.window.rootViewController = [[[SimpleController alloc] init] autorelease]; 

[self.window makeKeyAndVisible]; 

AppDelegate에

에서 할. 애니메이션이 끝나면 상태 표시 줄의 크기가 작은 흰색 줄무늬가 아래쪽에 표시되고 새로운보기가 표시되면서 아래로 점프합니다. 왜 그런 일이 일어나고 어떻게 피하는가? 상태 표시 줄이 비난한다고 가정하고 두보기 모두에서 statusBar = Unspecified를 IB에서 설정하려고 시도했지만 도움이되지 않습니다.

업데이트 : .info 파일의 설정을 통해 statusBar를 숨기면보기 조정이 수행되지 않습니다. 하지만 여전히 ... statusBar를 보여줘야하고 애니메이션이 제대로 작동해야합니다.

+0

주위에 방법이 있습니까? 나는 또한 같은 문제를 겪고있다. – Krishnabhadra

답변

2

상태 표시 줄이있는 경우 rootViewController가 창에 할당되면 a new frame is assigned이 rootViewController의보기에 할당됩니다. 이것은 rootViewController의 뷰가 상태 표시 줄 아래에 숨겨지지 않도록하기위한 것입니다.

애니메이션 블록 내에 윈도우의 rootViewController를 설정하기 때문에 새로운 프레임 할당도 애니메이션으로 표시됩니다.

- (IBAction) switchToVerySimpleController 
{ 
    CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame]; 

    VerySimpleController *vsc = [[[VerySimpleController alloc] init] autorelease]; 

    vsc.view.frame = CGRectMake(vsc.frame.origin.x, 
        statusBarFrame.size.height, 
        vsc.frame.size.width, 
        vsc.frame.size.height); 

    [UIView transitionWithView: [[UIApplication sharedApplication] keyWindow] 
         duration: 0.5 
         options: UIViewAnimationOptionTransitionFlipFromLeft 
        animations:^{ [[UIApplication sharedApplication] keyWindow].rootViewController = vsc } 
        completion: NULL]; 
} 
0

이 문제가 계속 때때로 일어날 것 같다 그것은 아마 버그 :

는이 같은 뭔가 애니메이션 전에 rootViewController의보기의 프레임을 설정할 수 있습니다 점프를 보여주지합니다.

신속한

navigationController?.navigationBar.layer.removeAllAnimations() 

목표 -C

[self.navigationController.navigationBar.layer removeAllAnimations]; 

께 :

이 '이동'도시되어야하는 뷰 컨트롤러 viewWillAppear 방법이 코드 추가를 방지하려면 전환은 '점프'없이 끝납니다.

관련 문제