2014-03-24 4 views
0

Apple 설명서 (https://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/presentViewController:animated:completion :) "iPhone 및 iPod touch에서 표시되는보기는 항상 전체 화면입니다." 하지만 iOS 7에는 맞춤보기 컨트롤러가 API를 전환합니다. "renderedViewController"가 원하는 크기가 될 수 있다는 것을 보여주는 데모가 이미 많이 있습니다. 이 경우 애플의 문서가 사실이 아닌가?iOS 7 사용자 지정 전환에 '보기 컨트롤러가 항상 전체 화면으로 표시됨'사실이 아닙니까?

+0

Apple의 문서는 정상입니다. 당신이 프레임/경계/가장자리 등 원하는대로 할 수있는 전환을 사용자 정의 할 때 그냥 잊어 버린 것 같아요. – Aaron

+0

기본적으로 가로 방향 iPhone 6+는 전체 화면 프레젠테이션을 모달 양식 시트에 적용합니다 , 기술적으로 설명서가 잘못되었습니다. iPhone 6+는 세로와 가로를 앞뒤로 회전 할 때 전체 화면과 모달 폼 사이를 자동으로 전환합니다. –

+0

@Aaron 문서는 다소 오해의 소지가 있습니다. 그렇습니다. 제시된 뷰가 "전체 화면"이라고 말하면서 기술적으로 정확하지만 API 문서의 대부분의 소비자에게는 도움이되지 않습니다. Apple 문서는 전체 화면으로 표시되지 않는 모양을 포함하여 표시되는보기가 완전히 사용자 정의 된 _appearance_를 가질 수 있음을 명확히 나타내도록 업데이트해야합니다. 이는 스타일의 사소한 문제 이상입니다. API를 갑자기 더 매력적이고 이해할 수있게 만드는 기본적인 사용성 문제입니다. – Womble

답변

4

오해의 소지가 있지만 Apple이 여전히 정확하다고 저는 믿습니다. 기본적으로 전체 화면으로 표시되지만 사용자 정의 전환 위임자를 제공하면 원하는 프레임을 지정할 수 있습니다.

Apple이 전체 화면으로 무엇을 의미하는지 (필자 생각에), 가장자리가 장치의 높이 인 & 너비의 최대 값까지 확장된다는 것입니다. 이전에는 추가되었을 수있는 탐색 바나 다른 툴바와 같은 항목에 의해 제한 될 수 있었지만 기본적으로 iOS 7에서는 더 이상 존중하지 않습니다.

그러나 사용자 지정 전환을 사용하면 전환 중에 더 작은보기 컨트롤러가 다른보기 컨트롤러와 오버레이되도록 할 수 있습니다. 예를 들어 여기 Teehan & 락스의 멋진 전환 API 게시물을 참조 :

http://www.teehanlax.com/blog/custom-uiviewcontroller-transitions/

여기 명확하게 전체 화면으로 될 것 아니에요 값으로 에 뷰 컨트롤러의 프레임을 설정하는 -animateTransition 방법입니다. 사용자 정의 전환을 뷰 컨트롤러를 제공 할 때

- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext { 
    // Grab the from and to view controllers from the context 
    UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 
    UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; 

    // Set our ending frame. We'll modify this later if we have to 
    CGRect endFrame = CGRectMake(80, 280, 160, 100); // <- frame is only 160 x 100 

    if (self.presenting) { 
     fromViewController.view.userInteractionEnabled = NO; 

     [transitionContext.containerView addSubview:fromViewController.view]; 
     [transitionContext.containerView addSubview:toViewController.view]; 

     CGRect startFrame = endFrame; 
     startFrame.origin.x += 320; 

     toViewController.view.frame = startFrame; 

     [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{ 
      fromViewController.view.tintAdjustmentMode = UIViewTintAdjustmentModeDimmed; 
      toViewController.view.frame = endFrame; 
     } completion:^(BOOL finished) { 
      [transitionContext completeTransition:YES]; 
     }]; 
    } 
    else { 
     toViewController.view.userInteractionEnabled = YES; 

     [transitionContext.containerView addSubview:toViewController.view]; 
     [transitionContext.containerView addSubview:fromViewController.view]; 

     endFrame.origin.x += 320; 

     [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{ 
      toViewController.view.tintAdjustmentMode = UIViewTintAdjustmentModeAutomatic; 
      fromViewController.view.frame = endFrame; 
     } completion:^(BOOL finished) { 
      [transitionContext completeTransition:YES]; 
     }]; 
    } 
} 

그래서, 당신은 당신이 그들에 대해 지정하는 중 가장자리 및/또는 프레임이됩니다- 및 에서 를 전환하십시오 endFrame 변수가 설정되어 라인을 참고 . 사용자 정의 전환을 시작할 때 갑자기 전체 화면이되지 않으므로 Apple이 옳다. 그러나 현재의 방법 설명에 대한 설명은 완전히 철저하지 않을 수 있습니다.