我有一个简单的动画来淡出图像,但它不起作用。正在调用该方法但没有动画。项目需要哪些框架?认为这可能是问题,因为图像恰好是alpha:0没有动画。
#import "TutorialViewController.h"
@interface TutorialViewController ()
@end
@implementation TutorialViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self popupImage];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)popupImage
{
NSLog(@"It worked");
_imageView.hidden = NO;
_imageView.alpha = 1.0f;
// Then fades it away after 2 seconds (the cross-fade animation will take 0.5s)
[UIView animateWithDuration:1
delay:2
options:UIViewAnimationOptionCurveEaseIn
animations:^{
_imageView.alpha = .0f;
}
completion:^(BOOL finished) {
// Once the animation is completed and the alpha has gone to 0.0, hide the view for good
_imageView.hidden = NO;
}];
}