UIView 动画无法调整视图大小 [英] UIView Animation not working to resize view
问题描述
我正在使用以下代码为 selectionMoreOptionView 的外观设置动画
I am using following code to animate the appearance of selectionMoreOptionView
[selectionMoreOptionView setFrame:CGRectMake(974, 56, 50, 0)];
[self.view insertSubview:selectionMoreOptionView aboveSubview:lightBoxView];
[lightBoxView setAlpha:0.0];
[UIView animateWithDuration:5.0
delay:0.0
options:UIViewAnimationOptionCurveLinear
animations:^{
[lightBoxView setAlpha:0.5];
[selectionMoreOptionView setFrame:CGRectMake(974, 56, 50, 100)];
} completion:^(BOOL finished) {
}];
但它没有动画,而是在没有动画的情况下立即出现.我做错了什么?
But it is not animating instead it just appears at once without animating. What i am doing wrong?
推荐答案
动画工作正常 问题是我在视图中有两个按钮,足够大以覆盖所有视图.未选中视图属性 Clip Subviews.我曾想过当父母调整它的大小时它会自动影响它的孩子,但在某些情况下当父母不剪辑它的子视图时它不会.谢谢大家的回复:)
The animation was working fine the problem was that i had two buttons inside the view big enough to cover all of the view. The views property Clip Subviews was unchecked. I had thought when a parent resizes it effects its child's automatically, but it don't in some cases when parent do not clip its subviews. Thanks everybody for your reply :)
这篇关于UIView 动画无法调整视图大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!