Ios 按钮上的动画(可能是翻转动画)选项卡上的图像更改
是否有一种方法可以将动画(可能是翻转动画)放在“按钮图像更改”选项卡上 我知道一种方法是使用UIView而不是UIButton。这可以在UIButton上完成吗Ios 按钮上的动画(可能是翻转动画)选项卡上的图像更改,ios,animation,uibutton,flip,Ios,Animation,Uibutton,Flip,是否有一种方法可以将动画(可能是翻转动画)放在“按钮图像更改”选项卡上 我知道一种方法是使用UIView而不是UIButton。这可以在UIButton上完成吗 谢谢您的帮助。检查此问题的第一个答案,可能就是您要寻找的答案 检查此问题的第一个答案,可能是您正在寻找的答案 老问题,但这里是我如何做类似事情的。它不是翻转而是淡入淡出,这对我来说很好,因为我的按钮没有背景(如果有,你会看到背景图像淡出淡入,看起来很奇怪;嘿,现在的趋势是无背景按钮;-) 不管怎样,我是这样做的: [UIView
谢谢您的帮助。检查此问题的第一个答案,可能就是您要寻找的答案
检查此问题的第一个答案,可能是您正在寻找的答案
老问题,但这里是我如何做类似事情的。它不是翻转而是淡入淡出,这对我来说很好,因为我的按钮没有背景(如果有,你会看到背景图像淡出淡入,看起来很奇怪;嘿,现在的趋势是无背景按钮;-) 不管怎样,我是这样做的:
[UIView animateWithDuration:.2f animations:^{
_accessoryButton.alpha = 0.f;
} completion:^(BOOL finished) {
[_accessoryButton setImage:newIcon forState:UIControlStateNormal];
[UIView animateWithDuration:.2f animations:^{
_accessoryButton.alpha = 1.f;
}];
}];
所以我要使按钮完全透明,更改图标,然后再次淡入按钮
我原以为我可以为_accessoryButton.imageView的不透明度设置动画,但由于某些原因,这不起作用。这是一个老问题,但我是如何做类似事情的。它不是翻转而是淡入淡出,这对我来说很好,因为我的按钮没有背景(如果有,你会看到背景图像淡出淡入,看起来很奇怪;嘿,现在的趋势是无背景按钮;-) 不管怎样,我是这样做的:
[UIView animateWithDuration:.2f animations:^{
_accessoryButton.alpha = 0.f;
} completion:^(BOOL finished) {
[_accessoryButton setImage:newIcon forState:UIControlStateNormal];
[UIView animateWithDuration:.2f animations:^{
_accessoryButton.alpha = 1.f;
}];
}];
所以我要使按钮完全透明,更改图标,然后再次淡入按钮
我想我可以设置_accessoryButton.imageView不透明度的动画,但由于某些原因,这不起作用。根据您的要求,它可以完美地工作:
[UIView transitionWithView:btn duration:0.5 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{
[btn setImage:[UIImage imageNamed:@"selectedicon.png"] forState:UIControlStateNormal];
} completion:nil];
试试这个。根据您的要求,它可以完美地工作:
[UIView transitionWithView:btn duration:0.5 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{
[btn setImage:[UIImage imageNamed:@"selectedicon.png"] forState:UIControlStateNormal];
} completion:nil];