iPhone – Uibutton Animation

Is it possible to make a uibutton in this way to make something or anything come out of the background, such as wheat ears from the field.

Is it possible?

Thank you:)

unless you want more complex animations, otherwise You can create a custom type UIButton (by changing the type to custom, use IB, or use UIButton * aButton = [UIButton buttonWithType: UIButtonTypeCustom] for programming), and then use [aButton] to set the button’s image set Image: [UI Image imageNamed:@”wheat_ear”forState:UIControlStateNormal].

Move it, usually just to animate its position…

[UIView animateWithDuration :0.5 animations:^{aButton.center = newCenter;}];

Or, in order to provide the illusion of coming out of the field, animate the border of the image so that it starts from the width and zero height of the image , And end with the width and height of the image:

CGRect originalFrame = aButton.frame;
aButton.frame = CGRectMake(originalFrame.origin.x, originalFrame.origin .y, originalFrame.size.width, 0);
[UIView animateWithDuration:0.5 animations:^{aButton.frame = originalFrame;}];

It is possible to make a uibutton in this way to make something or anything come out of the background, such as wheat ears from the field.

Is this possible?

Thank you:)

Unless you want more complex animations, you can create a custom type UIButton (by changing the type For customization, use IB, or use UIButton * aButton = [UIButton buttonWithType: UIButtonTypeCustom] for programming), and then use [aButton] to set the button image set Image: [UI Image imageNamed: @”wheat_ear” forState: UIControlStateNormal]. < p>

Move it, usually just to animate its position…

[UIView animateWithDuration:0.5 animations:^{aButton.center = newCenter; }];

Or, in order to provide the illusion of coming out of the field, animate the border of the image so that it starts with the width and zero height of the image and ends with the width and height of the image: p>

CGRect originalFrame = aButton.frame;
aButton.frame = CGRectMake(originalFrame.origin.x, originalFrame.origin.y, originalFrame.size.width, 0);
[UIView animateWithDuration:0.5 animations:^{aButton.frame = originalFrame;}];

Leave a Comment

Your email address will not be published.