i am wondering how to animate a button in, an example is snapchat. When the user enters their credentials in to both fields, as in when they are not empty, they animate the login button in:
Any suggestions on how this is done?
Use the imageView property of UIButton. You can create an animation like this:
[myButton setImage:[UIImage imageNamed:@"1.png"] forState:UIControlStateNormal];
myButton.imageView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
nil];
myButton.imageView.animationDuration = 0.5;
[myButton.imageView startAnimating];
You can use animateWithDuration:
[UIView animateWithDuration:0.3f delay:0.0f options:UIViewAnimationOptionCurveEaseInOut animations:^{
[myButton setFrame:CGRectMake(0.0, 40.0, 320, 50)];
} completion:nil];