2017-11-20 2 views
0

업데이트 내가 제시 컨트롤러 모두에서이 작업을 수행 할 경우 예상대로 작동 것으로 나타났습니다이 주위에 재생사용자 정의 언 와인드 SEGUE

:

self.dismiss(animated: true) 

그리고 사용자 정의 SEGUE의 애니메이션 실행됩니다. 그러나 이런 식으로 긴장을 풀려고하면 :

self.performSegue(withIdentifier: "logoDisplayed", sender: self) 

그러면 아래에 언급 된 충돌이 발생합니다. 또한 'kind'를 'modally present'로 설정하면 사용자 지정 segue가 작동한다는 것을 발견했습니다. 만약 내가 'Custom'으로 설정했다면, 분명히 거기에도 불구하고 아무런 perform()도 없다는 충돌이 발생합니다.

아직 이것을 파악하려고합니다.

원래의 게시물

나는이 (here, herehere)

이전에 대해 이야기하고있다하지만 사용자 정의가 iOS11에서 작업 SEGUE을 긴장 얻을 수 없었던 것을 알고있다. 아래는 내가 사용하고있는 커스텀 세그이다. 모델 segue 클래스로 설정하면 완벽하게 작동하지만 unwind segue 클래스로 설정하면 작동하지 않습니다. 이 오류와 응용 프로그램 충돌 대신 :

2017-11-20 22:29:09.640934+1100 Crux[46709:6046351] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
reason: 'Could not perform segue with identifier 'logoDisplayed'. 
A segue must either have a performHandler or it must override -perform.' 
*** First throw call stack: 
(
0 CoreFoundation      0x00000001100c012b __exceptionPreprocess + 171 
1 libobjc.A.dylib      0x000000010f06bf41 objc_exception_throw + 48 
2 UIKit        0x0000000111c1061d -[UIStoryboardSegue _prepare] + 0 
3 Crux        0x000000010dacecc8 _T04Crux13AnimatedSegueC7performyyF + 280 
... 

과 같이 SEGUE의 설정 :

enter image description here

내 SEGUE의 코드는 이것이다는 :

class FadeInAnimator: NSObject, UIViewControllerAnimatedTransitioning { 

    func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { 
     return 2.0 
    } 

    func animateTransition(using transitionContext:  UIViewControllerContextTransitioning) { 

     let containerView = transitionContext.containerView 
     let toVC = transitionContext.viewController(forKey:UITransitionContextViewControllerKey.to) 

     containerView.addSubview(toVC!.view) 
     toVC!.view.alpha = 0.0 

     let duration = transitionDuration(using:transitionContext) 
     UIView.animate(withDuration:duration, 
         animations: { 
         toVC!.view.alpha = 1.0 
     }, 
         completion: { finished in 
         let cancelled = transitionContext.transitionWasCancelled 
         transitionContext.completeTransition(!cancelled) 
     }) 
    } 
} 

class AnimatedSegue:UIStoryboardSegue, UIViewControllerTransitioningDelegate { 

    override func perform() { 
     source.transitioningDelegate = self 
     destination.transitioningDelegate = self 
     super.perform() 
    } 

    func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { 
     return FadeInAnimator() 
    } 

    func animationController(forPresented presented: UIViewController, 
          presenting: UIViewController, 
          source: UIViewController) -> UIViewControllerAnimatedTransitioning? { 
     return FadeInAnimator() 
    } 
} 

사람은 어디 수도 알고 잘못 갔어?

+0

Xcode 9.1, iOS 11 시뮬레이터. 나는이 충돌을 재현 할 수 없었다. 어쩌면 새로운 프로젝트에서 재창조 해보십시오. –

답변

0

발견. 나는 소스 컨트롤러에 앉아있는 오래된 코드를 가지고있다 :

override func segueForUnwinding(to toViewController: UIViewController, from fromViewController: UIViewController, identifier: String?) -> UIStoryboardSegue? { 
    return AnimatedSegue(identifier: identifier, source: fromViewController, destination: toViewController) 
} 

어떤 것이 호출되어 문제를 일으켰다.

관련 문제