Note that there are some explanatory texts on larger screens.

plurals
  1. POremoveFromSuperview crash if don't use UIViewAnimation
    primarykey
    data
    text
    <p>I meet a strange problem. I use removeFromSuperview cause my app crush. but if I use [UIView animationWithDuration], it's gone be ok.</p> <p>see below This can be run successful.</p> <pre><code> [self willMoveToParentViewController:nil]; [UIView animateWithDuration:0.5 animations:^(void){ CATransition *transition = [CATransition animation]; transition.type = kCATransitionReveal; transition.subtype = kCATransitionFromBottom; transition.duration = 0.5; [self.view.superview.layer addAnimation:transition forKey:nil]; } completion:^(BOOL finished){ [self.view removeFromSuperview]; [self removeFromParentViewController]; }] ; </code></pre> <p>but if I remove the [UIView animationWithDuration] like this.</p> <pre><code> [self willMoveToParentViewController:nil]; [self.view removeFromSuperview]; [self removeFromParentViewController]; </code></pre> <p>It's gone be crashed.</p> <p>and here is how I add the subview</p> <pre><code> [self.tabBarController addChildViewController: vc]; CATransition *transition = [CATransition animation]; transition.type = kCATransitionMoveIn; transition.subtype = kCATransitionFromTop; transition.duration = 0.5; [self.tabBarController.view.layer addAnimation:transition forKey:nil]; [self.tabBarController.view addSubview:vc.view]; [self.tabBarController didMoveToParentViewController:vc]; </code></pre> <p>I have no idea why this happened. Hope someone can help me . It's a weird problem. <img src="https://i.stack.imgur.com/17jx9.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    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