我已经设置了一个自定义转换,设置为 similar to this tutorial here .
我现在要做的是更新(下方)UIViewController
上的 BOOL。这是在顶部显示 Controller 的 Controller 。
我如何获得对下面 Controller 的访问/指针?我试过 self.presentingViewController 但这指向一个 UINavigationController
。
自定义转换信息
底部 Controller 是 UIViewControllerTransitioningDelegate
。 Controller 通过 segue 链接。以下是在 prepareForSegue
中:
self.animationController = [[MESGuessGameTurnZoomAnimation alloc] init];
UIViewController *destVC = segue.destinationViewController;
destVC.transitioningDelegate = self;
当呈现目标 View Controller 时,用户可以单击“返回”,这将简单地运行以下(目前)以返回到原始 View Controller :
[self dismissViewControllerAnimated:YES completion:nil];
最佳答案
听起来您正试图将数据从 presentedVC 传回 presentingVC。如果是这种情况,无论您是否使用新的 iOS 7 自定义动画过渡,方法都是相同的。
您有 2 个选项,如果您使用标准过渡或自定义过渡,同样如此。
单击“返回”时使用委托(delegate)模式。这样,presentingVC 调用就会被取消,并且可以访问 presentedVC 及其任何属性。
How do I set up a simple delegate to communicate between two view controllers?
使用展开转场。这完成了同样的事情,但使用了 Storyboard。 https://developer.apple.com/library/ios/technotes/tn2298/_index.html
您可以使用 transitioningContext
在 prepareForSegue:
和 animationController 的 animateTransition:
方法中访问这两个 View Controller ,但我认为您只是谈论传输回数据,这可以使用上述方法之一来完成。
关于ios - 从自定义转换中引用 presentingViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21124794/