如何动画一个图像按钮,四个或五个按键顶部? [英] How to animate the one image button to the top of four or five buttons?

查看:164
本文介绍了如何动画一个图像按钮,四个或五个按键顶部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的iOS开发动画。如何动画一个图像按钮,四个或五个按钮中的iOS顶部?每当点击任一按钮时,图像按钮被放置在该按钮的顶部。

I am new to animation in iOS development. How to animate the one image button to the top of four or five buttons in iOS? Whenever I tap any of the buttons, the image button has to be placed at the top of that button.

推荐答案

在.h文件中,声明的ImageButton为:

In .h file,declare the imageButton as:

    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]];
}

对于剩下的四个按钮,在厦门国际银行文件, touchupinside - (IBAction为)btnMoveTo:(ID)发送方法。
而对于在厦门国际银行文件的ImageButton,里面润色方法与 - (IBAction为)btnDownUnder:(ID)发送方法和引用插座 mvngButton

For the remaining four buttons,in xib file,touchupinside with the -(IBAction) btnMoveTo:(id)sender method. And for the imageButton in xib file,touch up inside method with the -(IBAction) btnDownUnder:(id)sender method and the referencing outlet with the mvngButton.

这篇关于如何动画一个图像按钮,四个或五个按键顶部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆