Animation in viewDidLoad

For some reason, my animation only works when executed IBAction

, not through viewDidLoad

. I want these images to start animating as soon as they load view

.

myImageView.animationImages = [NSArray arrayWithObjects:
                              [UIImage imageNamed:@"image1.png"],
                              [UIImage imageNamed:@"image2.png"], nil];
[myImageView setAnimationRepeatCount:0];
myImageView.animationDuration = 2;
[myImageView startAnimating];

      

+3


source to share


1 answer


Move the animation from viewDidLoad

to viewDidAppear

. You cannot animate the components of your view until it has finished layout.



+5


source







All Articles