开发者

view animations

开发者 https://www.devze.com 2023-02-11 08:56 出处:网络
I\'m trying t开发者_JS百科o add a sub view with Core-Animation using the attached code. First time it happens as expected, but after that there\'s a flash of white in the place of the sub-view before

I'm trying t开发者_JS百科o add a sub view with Core-Animation using the attached code. First time it happens as expected, but after that there's a flash of white in the place of the sub-view before it's fully pushed.

// Add the picker
viewToPush.frame = CGRectMake(0,185,320, 258);

CATransition *animation = [CATransition animation];
[animation setType:kCATransitionMoveIn];
[animation setSubtype:kCATransitionFromTop];

[self.view addSubview:viewToPush];
[viewToPush.layer addAnimation:animation forKey:nil];

btw, in order to remove the subView I just use

[viewToRemove removeFromSuperview];

10x


Why do you add the animation to the viewToPush's layer, not the super view's? I suspect the layer of viewToPush is not stable as you remove the view from the super view. Do you have many views that can act as viewToPush or viewToRemove so they have to be dynamically allocated? Otherwise I would just change their hidden properties to implement such animations.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号