Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This (original part) is not to take away from H2CO3's correct answer. <code>UIModalTransitionStyleCrossDissolve</code> does pretty-much exactly the effect you're looking for. You are just not setting the modalTransitionStyle until it's to late. Replace all of your code with these functions in there respective positions:</p> <pre><code>-(void)show{ self.infoViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:self.infoViewController animated:YES]; } - (IBAction)dismissAction:(id)sender{ [self dismissModalViewControllerAnimated:YES]; } </code></pre> <p><strong>Edit in response to timing being an issue:</strong> Let's talk about the offending code. We'll concentrate on just the if true part, since it's essentially identical to the else.</p> <pre><code>[[self parentViewController] dismissModalViewControllerAnimated:YES]; self.parentViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; self.parentViewController.view.alpha = 0.0; [UIView animateWithDuration:0.5 animations:^{self.parentViewController.view.alpha = 1.0;}]; </code></pre> <p>If you're looking for a reciprocal animation this isn't it. In your original animation you set the next view's alpha to 0, then presented the next view controller, then set it's view's alpha to 1. So logically you need to dismiss the view controller after the animation; This is really easy using blocks. The code would look something like this:</p> <pre><code>[UIView animateWithDuration:0.5 animations:^{ self.view.alpha = 0; } completion:^(BOOL b){ [self.presentingViewController dismissModalViewControllerAnimated:NO]; self.view.alpha = 1; }]; </code></pre> <p>This line of code animates the view's alpha to 0, then (upon completion) dismisses the presented view controller, and sets the view's alpha back to 1. This is a reciprocal animation.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload