우리의 응용 프로그램을 스토리 보드로 변환하려고 시도하고 있으며 사용자 정의 컨테이너 컨트롤러를 다룰 때 unwind segues를 처리 할 때 버그가 있다고 생각합니다. 우리는 또 다른 하나를 표시하고 이것을 수행하기 위해 뷰 컨트롤러 봉쇄 API를 사용하는 뷰 컨트롤러가 있는데, 나는 IB의 세그 (segue)를 연결 한 다음 구현을위한 사용자 정의 클래스를 선택합니다. 완벽하게 작동사용자 정의보기 컨트롤러 포함을 사용할 때 unwind segues를 만들 수 없습니다.
-(void) perform {
UIViewController *container = [self sourceViewController];
UIViewController *child = [self destinationViewController];
[container addChildViewController:child];
[container.view addSubview:child.view];
child.view.center = container.view.center;
[UIView transitionWithView:container.view
duration:0.35
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
child.view.alpha = 1;
} completion:^(BOOL finished) {
[child didMoveToParentViewController:container];
}];
}
는, 그러나 나는 그것이 다시 용기 컨트롤러에 언 와인드 SEGUE을 수행 할 수 없습니다 다음 수행 방법은 다음과 같이 보입니다. fromViewController : withSender을 : 나는 viewControllerForUnwindSegueAction을 무시하고 올바른 값을 반환하는 것 있는지 확인하십시오
는-(UIViewController *) viewControllerForUnwindSegueAction:(SEL)action fromViewController:(UIViewController *)fromViewController withSender:(id)sender {
id default = [super viewControllerForUnwindSegueAction:action fromViewController:fromViewController withSender:sender];
NSAssert1(default == self, @"Expected the default view controller to be self but was %@", default);
return default;
}
나는 또한 그 canPerformUnwindSegueAction을 확인할 수 있습니다
는 : fromViewController : withSender 호출하고, 옳은 일을하고 있지만 반드시되고 있는지 나는 그것을 오버라이드 YES
-(BOOL) canPerformUnwindSegueAction:(SEL)action fromViewController:(UIViewController *)fromViewController withSender:(id)sender {
return YES;
}
를 반환하는 나는 일이 기대하는 다음 단계는 segueForUnwindingToViewController입니다 : fromViewController : 식별자 : 호출 할, 그러나 그것이 결코. 대신 응용 프로그램이 NSInternalInconsistencyException과 충돌합니다.
2012-10-01 10:56:33.627 UnwindSegues[12770:c07] *** Assertion failure in -[UIStoryboardUnwindSegueTemplate _perform:], /SourceCache/UIKit_Sim/UIKit-2372/UIStoryboardUnwindSegueTemplate.m:78
2012-10-01 10:56:33.628 UnwindSegues[12770:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not find a view controller to execute unwinding for <USCustomContainerViewController: 0x75949a0>'
*** First throw call stack:
(0x1c8e012 0x10cbe7e 0x1c8de78 0xb61f35 0x581711 0x45ab54 0x10df705 0x16920 0x168b8 0xd7671 0xd7bcf 0xd6d38 0x4633f 0x46552 0x243aa 0x15cf8 0x1be9df9 0x1be9ad0 0x1c03bf5 0x1c03962 0x1c34bb6 0x1c33f44 0x1c33e1b 0x1be87e3 0x1be8668 0x1365c 0x1e7d 0x1da5)
libc++abi.dylib: terminate called throwing an exception
누가보기 컨트롤러 포함 API와 결합 된 unwind segues를 성공적으로 사용 했습니까? 어떤 단계가 빠졌는지 알 수 있습니까? demo project to github을 업로드하여 가장 간단한 데모 프로젝트에서 문제점을 보여주었습니다.
참조 : http://openradar.appspot.com/radar?id=2144402 –