Pergunta

I have setup a custom transition which is setup similar to this tutorial here.

What I am trying to do now is update a BOOL on the (below) UIViewController. This is the controller that presents the controller on top.

How do I get access/a pointer to the below controller? I have tried self.presentingViewController but this is pointing to a UINavigationController.

Custom Transition Info
The bottom controller is the UIViewControllerTransitioningDelegate. The controllers are linked by a segue. The following is in the prepareForSegue:

self.animationController = [[MESGuessGameTurnZoomAnimation alloc] init];
UIViewController *destVC = segue.destinationViewController;    
destVC.transitioningDelegate = self;

When the destination view controller is presented the user can click Back which simply runs the following (at present) to return to the original view controller:

[self dismissViewControllerAnimated:YES completion:nil];
Foi útil?

Solução

It sounds like you're trying to pass data back from the presentedVC to the presentingVC. If that's the case, the approach is the same whether you're using the new iOS 7 custom animated transitions or not.

You have 2 options, again the same if you use a standard transition or a custom transition.

  1. Use a delegate pattern when you click Back. That way the presentingVC calls dismiss and can access the presentedVC and any of it's properties.

    How do I set up a simple delegate to communicate between two view controllers?

  2. Use an unwind segue. This accomplishes the same thing but using storyboards. https://developer.apple.com/library/ios/technotes/tn2298/_index.html

You can access both view controllers in prepareForSegue: and in the animationController's animateTransition: method using the transitioningContext but I think you're just talking about transferring back data and that can be done using one of the above approaches.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top