0

I have a master and detail view controller. I have a button that currently disappears after the push segue to the detail and reappears when the pop segue is called, whether it's the interactive gesture or the back button.

This looks really abrupt and I wanted to fade in the alpha on the button with the pop gesture but I don't see any delegate or datasource methods for UINavigationControllerDelegate that show the progress of the pop gesture. Are there any libraries that help with this?

George Urick
  • 135
  • 10

1 Answers1

0

This can be accomplished with a UIView animation.

The idea is to set the alpha of the button to 0 so that it is invisible and then animate it to a value of 1 to create a fade-in effect.

self.myButton.alpha = 0;

[[UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
    self.myButton.alpha = 1;
} completion:^(BOOL finished) {
    // Code for completion of animation.
}];

This could be placed in the viewDidAppear: method of your view controller.

Daniel Zhang
  • 5,778
  • 2
  • 23
  • 28
  • This would be fine if only allowing back button pop. But because uinavigationcontroller allows the interactive pan gesture, I need a way to dynamically change alpha during the transition, not when the transition is finished. – George Urick Oct 20 '15 at 23:13
  • @GeorgeUrick If you move the animation to `viewWillAppear:`, it will take place during the transition involving the interactive pan gesture for going back. – Daniel Zhang Oct 20 '15 at 23:33