I have an idea about how to add animated UIImageView using frame by frame method BUT my question is about How to animate UIImageView ALREADY added on view controller storyboard as IBOutlet UIImageView .
what will be changed at this peace of code ?!
NSArray *myImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"bookmark1.png"],
[UIImage imageNamed:@"bookmark2.png"],
[UIImage imageNamed:@"bookmark3.png"],
[UIImage imageNamed:@"bookmark4.png"],
[UIImage imageNamed:@"bookmark5.png"],nil];
myAnimatedView = [UIImageView alloc];
[myAnimatedView initWithFrame:CGRectMake(0, 0, 131, 125)];
myAnimatedView.animationImages = myImages;
myAnimatedView.animationDuration = 0.25;
myAnimatedView.animationRepeatCount = 1;
[myAnimatedView startAnimating];
[self.navigationController.view addSubview:myAnimatedView];
I want to animate this image like that over my viewController
It’s even easier. First, add in .h file:
After, connect this outlet to the actual UIImageView on your storyboard. Change your code:
And that’s all. Hope this helped
p.s. And yes, don’t forget iV = nil; in – (void)viewDidUnload method
UPD: added
After startAnimating call, and obviously added animationDone method: