Ios 如何将一个图像按钮设置为四个或五个按钮顶部的动画?

Ios 如何将一个图像按钮设置为四个或五个按钮顶部的动画?,ios,animation,button,imagebutton,Ios,Animation,Button,Imagebutton,我不熟悉iOS开发中的动画。如何在iOS中将一个图像按钮设置为四个或五个按钮的顶部?每当我点击任何一个按钮时,图像按钮都必须放在该按钮的顶部。通过给出 [self.view bringSubViewToFront:buttonName]; 并实现这样的动画 CGRect basketBottomFrame = basketBottom.frame; basketBottomFrame.origin.y = self.view.bounds.size.height; [UIView begin

我不熟悉iOS开发中的动画。如何在iOS中将一个图像按钮设置为四个或五个按钮的顶部?每当我点击任何一个按钮时,图像按钮都必须放在该按钮的顶部。

通过给出

[self.view bringSubViewToFront:buttonName];
并实现这样的动画

CGRect basketBottomFrame = basketBottom.frame;
basketBottomFrame.origin.y = self.view.bounds.size.height;

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelay:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];

basketTop.frame = basketTopFrame;
basketBottom.frame = basketBottomFrame;

[UIView commitAnimations];

在.h文件中,将imageButton声明为:

    int selectedCurveIndex;
    @property(nonatomic,retain)IBOutlet UIButton *mvngButton;
   -(IBAction) btnMoveTo:(id)sender;
-(IBAction) btnDownUnder:(id)sender;
在.m文件中

static int curveValues [] = {
UIViewAnimationOptionCurveEaseInOut,
UIViewAnimationOptionCurveEaseIn,
UIViewAnimationOptionCurveEaseOut,
UIViewAnimationOptionCurveLinear};

   -(IBAction) btnMoveTo:(id)sender
{
UIButton *btn=(UIButton *)sender;
[mvngButton moveTo: CGPointMake(btn.center.x - (mvngButton.frame.size.width/2),btn.frame.origin.y - (mvngButton.frame.size.height + 5.0))duration:2.0 option:curveValues[selectedCurveIndex]];
}
-(IBAction) btnDownUnder:(id)sender
{
UIButton *btn=(UIButton *)sender;
[btn downUnder:1.0 option:curveValues[selectedCurveIndex]];
}
对于其余四个按钮,在xib文件中,使用
-(iAction)btnmovoint:(id)sender
方法,
toucupinside
。 对于xib文件中的imageButton,
使用
-(iAction)btndown下的
方法对内部进行润色,并使用
mvngButton
方法对
参考插座进行润色