在app Store中如何制作购买按钮动画?

时间:2023-01-12 20:01:51

I've tried creating two UIButtons programatically as described here. This works great but there doesn't seem to be a simple transition for expanding the UIButton on the left as seen in the Apps Store.

我已经尝试过按照这里的描述创建两个uibutton。这很好,但似乎没有一个简单的转换,可以将UIButton扩展到应用程序商店中看到的左边。

2 个解决方案

#1


0  

If you would like to animate the size of your button, you can use transforms or make the frame larger. Just set the new frame or transform, start the animation, and your button should animate to it's new size.

如果您想让按钮的大小有动画效果,您可以使用转换或使框架更大。只要设置新的帧或转换,启动动画,你的按钮应该动画到它的新大小。

#2


0  

Assuming your button starts as 50 wide, 38 high and is at the 100,100 point of the screen:

假设你的按钮50宽,38高,在屏幕的100,100点:

[UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:.5];
    yourButton.frame = CGRectMake(70, 100, 80, 38); // this makes the button 80 wide, expanding to the left
    //here you can change other values, such as the background image and title.
    [UIView commitAnimations];

#1


0  

If you would like to animate the size of your button, you can use transforms or make the frame larger. Just set the new frame or transform, start the animation, and your button should animate to it's new size.

如果您想让按钮的大小有动画效果,您可以使用转换或使框架更大。只要设置新的帧或转换,启动动画,你的按钮应该动画到它的新大小。

#2


0  

Assuming your button starts as 50 wide, 38 high and is at the 100,100 point of the screen:

假设你的按钮50宽,38高,在屏幕的100,100点:

[UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:.5];
    yourButton.frame = CGRectMake(70, 100, 80, 38); // this makes the button 80 wide, expanding to the left
    //here you can change other values, such as the background image and title.
    [UIView commitAnimations];