A tutorial teaching you how to animate a UIImageView so it fades in and out nicely with the click of a button.
Main Code Used:
-(IBAction)hideImage {
CGContextRef *imageContext = UIGraphicsGetCurrentContext();
if (image.alpha == 1) {
[UIView beginAnimations:nil context:imageContext];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration:3];
[UIView setAnimationDelegate:self];
image.alpha = 0.0;
[button setText:@"Show Image" forState:UIControlStateNormal];
} else if (image.alpha == 0.0) {
[UIView beginAnimations:nil context:imageContext];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:3];
[UIView setAnimationDelegate:self];
image.alpha = 1;
[button setText:@"Hide Image" forState:UIControlStateNormal];
}
[UIView commitAnimations];
}
Next Video: http://www.youtube.com/watch?v=a_MPhB4Xnps
Previous Video: http://www.youtube.com/watch?v=H1wOlmwN94o
Link: http://developer.apple.com/devcenter/ios/index.action
Website: http://failcake.webs.com/
Twitter: http://twitter.com/failcakeapps
Channel: http://youtube.com/milmersxcode
Man continue with the great tutorials, it helps me a lot! But I would Still love if you could put the code in the description. Thanks!
LockerzSwagbucks 1 year ago
@LockerzSwagbucks Thanks alot. The next Tutorial in this series is out so go and watch it. Link in the description. My Next series will be on UITableViews so stay tuned for that as well.
MilmersXcode 1 year ago
@LockerzSwagbucks I won't put all the code in the descriptions but the main bits of code that will be used in the video. Hope this helps :D
MilmersXcode 1 year ago