如题
是这样的 比如我有一个uiview 上面有一个UIimageview和UIlabel 当我用[UIView animateWithDuration:0.2 animations:^{}];这个动画函数 将UIview变大 但是发现上面的UIimageview和UIlabel的视图并没有跟随变大,是不是只有取到UIview的子视图UIimageview和UIlabel做操作让其变大 这样的话就太麻烦了 比如 我UIview的子视图很多 那不是操作就更多了,有没有什么办法是只需要改变UIview的大小其他的子视图跟随变大的办法呢?
大家讲道理2017-04-17 17:59:00
http://blog.csdn.net/wxs0124/article/details/40296009 I just came across this article. I hope it helps
巴扎黑2017-04-17 17:59:00
Just use the simplest scale transformation.
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
animation.fromValue = @(1.0);
animation.toValue = @(2.0);
animation.duration = 2.0f;
animation.repeatCount = 1;
[self.button.layer addAnimation:animation forKey:@"ScaleAnimation"];
If you usually use pop, this is it:
POPBasicAnimation *animation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewScaleXY];
animation.toValue = [NSValue valueWithCGPoint:CGPointMake(2.0, 2.0)];
animation.duration = 3.0f;
[self.button pop_addAnimation:animation forKey:@"ScaleAnimation"];
PHPz2017-04-17 17:59:00
If you use automatic layout, set the distance from the child control to the parent control and call LayoutIfNeed to re-layout