Reputation: 1769
I have two buttons.
One at the top and one at the bottom of my iphone screen.
I want to animate a third button which is hidden until I press the button at the bottom.
I know how to do simple animation, like this:
- (IBAction)myClickAction:(id)sender {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationDelay:0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
//this is my problem part...
[[self thirdButton] setHidden:FALSE];
}
I understand that on my button on which my click is performed the animation will be applied but how to apply it on the third button?
Upvotes: 0
Views: 645
Reputation: 8576
Your question wasn't quite clear, but I'm assuming you want to just animate the third button in from being hidden. The best way to do this would probably be to use the button's alpha
value.
When you want to hide the button, set it's alpha
to 0
, which means completely transparent.
[[self thirdButton] setAlpha:0.0];
Then, when you want to animate the button in, you can use animations like this to change the alpha
to 1
:
[UIView animateWithDuration:1.0 animations:^{
[[self thirdButton] setAlpha:1.0];
}];
Note that you can use an animation like you had, but blocks tend to be much cleaner. Also, you never called [UIView commitAnimations];
in your example.
Upvotes: 2