Note that there are some explanatory texts on larger screens.

plurals
  1. POUIView animation doesn't work for UIViewController subclass
    text
    copied!<p>I try to add a subview(which is a subclassed UIViewController's view, consists of several UIButtons and UILabels) to current view, but the animation doesn't work, the subview just appeared without animation.</p> <p>the code is :</p> <pre><code>[UIView beginAnimations:nil context:nil]; [UIView setAnimaitonCurve:UIViewAnimationCurveLinear]; [UIView setAnimationDuration:0.5f]; [UIView setAnimationTransition:transition forView:thisPersonViewController.view cache:YES]; [self.view addSubView:thisPersonViewController.view]; [UIView commitAnimations]; </code></pre> <p>it just doesn't work, but if I change <strong>forView</strong> parameter from <strong>the subview</strong> (thisPersonViewController.view) to <strong>self.view</strong>, the self.view did animate, that's curios.</p> <p>My xcode version is 4.2 and SDK version is 5.0, thx for anyone who offer an solution!</p> <p>===========THE FOLLOWING CODE WORKS FINE===============</p> <pre><code>CATransition *trans = [CATransition animation]; [trans setDuration:0.4f]; [trans setType:kCATransitionReveal]; [trans setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; [[thisPersonViewController.view layer]addAnimation:trans forKey:kCATransitionReveal]; [self.view addSubview:thisPersonViewController.view]; </code></pre> <p>Another annoying question is if I change the CATransition type to <strong>kCATransitionFromBottom</strong> or something else the animation doesn't work again !</p>
 

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