Question: I have a controller that uses an animated UIImageView to display a sequence of 30 512 x 512 frames. When I run the application the view quickly does the following.

```
- (void)viewDidLoad {
    [super viewDidLoad];
    [[self imageView] setAnimationImages:[[self dataModel] framesForLOOP]];
    [[self imageView] setAnimationDuration:2.5];
    [[self imageView] setAnimationRepeatCount:1];
    [[self imageView] startAnimating];
    NSLog(@"MARKER_001");
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    NSLog(@"MARKER_002");
}

```

This all works fine but what I am trying to work out is that after `viewDidLoad:` is called there is a 2 second delay before `viewDidAppear:` is called (between MARKER\_001 and MARKER\_002). 

I was thinking there might be a delay setting up the frames `NSArray` or after calling `setAnimationImages:` or maybe after `startAnimating`.

Is there anyway to reduce/remove this delay, I would prefer to preload the animation at startup and take a hit there rather than having the delay when the viewController loads as it makes the button that fires the segue to instantiate the new controller feel laggy.

Answer: 
Just a few ideas:

1. reduce the pain - do you need 30x512x512?
2. distribute the pain - load the first image on viewWillAppear, kick off an operation to load the others and update the animation images as new images are ready (can supply code e.g. if needed)
3. move the pain - prepare the array of UIImages in app init.
4. dig deeper - let's have a look at the framesForLoop method, maybe there's some more opportunity to reduce/distribute/move the pain in there.
Note that even if you call `startAnimating` in `viewDidLoad`, the animation won't start there. You can't get an animation running in a controller which has not been not displayed yet.

You should call the `startAnimating` in `viewDidAppear` instead.

Two seconds delay between these two methods is not anything strange. The delay can be much longer or shorter, depending on what happens inside your application.
Measuring the time between two methods which are not connected doesn't make sense. What about measuring how much time the individual methods take?

If anything is laggy, you should probably paste all the code that happens between the user action and the moment when everything is displayed and the lag happens.