我正在提交这个简单的动画,它会导致按钮缩小到0:的宽度
[UIView animateWithDuration:0.2
delay: 0.0
options: UIViewAnimationOptionCurveEaseIn
animations:^{
[btnActionButton setFrame:CGRectMake(160, 10, 0, 55)];
}
completion:^(BOOL finished){
}];
现在的问题是,一旦动画开始,按钮的标题标签就会自动隐藏。。。我使用模拟器的slowAnimation模式确保了这一点。
在动画过程中,标签是否也会随着帧而收缩,因为如果按钮标题在开头消失,看起来会很尴尬。
提前谢谢。Obaid
宽度为0。
使用以下代码。
[UIView animateWithDuration:0.2
delay: 0.0
options: UIViewAnimationOptionCurveEaseIn
animations:^{
[btnActionButton setFrame:CGRectMake(160, 10, 50, 55)];
}
completion:^(BOOL finished){
}];
代替50,给出动画后按钮所需的宽度。
[UIView animateWithDuration:0.2
delay: 0.0
options: UIViewAnimationOptionCurveEaseIn
animations:^{
[btnActionButton.titleLabel setCenter:CGPointMake(-64, btnActionButton.titleLabel.center.y)];
[btnDeleteButton setFrame:CGRectMake(160, 10, 128, 55)];
}
completion:^(BOOL finished){
[btnActionButton setFrame:CGRectMake(160, 10, 0, 55)];
[btnActionButton.titleLabel setCenter:CGPointMake(0, btnActionButton.titleLabel.center.y)];
}];
这就是我成功的方式。。。事实上,我想让第一个按钮消失,第二个按钮以滑动的方式出现。
也尝试设置标签的动画。我的意思是:
[UIView animateWithDuration:0.2
delay: 0.0
options: UIViewAnimationOptionCurveEaseIn
animations:^{
[btnActionButton setFrame:CGRectMake(160, 10, 0, 55)];
[btnActionButton.titleLabel setFrame:CGRectMake( 0, 0, 0, 55)];
}
completion:^(BOOL finished){
}];
希望这能有所帮助。
干杯!