我正在以这种方式为 UIButton 的宽度和高度变化设置动画:
[UIView animateWithDuration:0.5
delay:0.0
options: UIViewAnimationCurveEaseInOut
animations:^{
CGRect frame = [[sender view] frame];
frame.size.width = 0;
frame.size.height = 0;
[[sender view] setFrame:frame];
}
completion:^(BOOL finished){
}];
按钮可以很好地改变大小,但我希望它在中心关闭,而不是在角落关闭。我知道这是因为它关闭了 x 和 y 坐标,但我可以让它关闭到中心吗?
最佳答案
这就是你想要的动画 block :
[sender view].frame = (CGRect){[[sender view] center],CGSizeZero};
关于ios - UIButton 随中心改变大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18805020/