title: Loading images for animation in UIImageView - iOS
body: <p>I have around 300 images to be loaded for animation the images are named <code>loading001.png, loading002.png, loading003.png, loading004.png………loading300.png</code></p>
  
  <p>I am doing it in the following way.</p>
  
  <p><strong>.h file</strong></p>
  
  <pre><code>    #import &lt;UIKit/UIKit.h&gt;
      @interface CenterViewController : UIViewController  {
          UIImageView *imgView;
      }
  
      @end
  </code></pre>
  
  <p><strong>.m file</strong></p>
  
  <pre><code>@implementation CenterViewController
  
  - (void)viewDidLoad {
      [super viewDidLoad];
  
      imgView = [[UIImageView alloc] init];
      imgView.animationImages = [[NSArray alloc] initWithObjects:
                                 [UIImage imageNamed:@"loading001.png"],
                                 [UIImage imageNamed:@"loading002.png"],
                                 [UIImage imageNamed:@"loading003.png"],
                                 [UIImage imageNamed:@"loading004.png"],
                                 nil];
  }
  
  - (IBAction)startAnimation:(id)sender{
      [imgView startAnimating];
  }
  
  @end
  </code></pre>
  
  <p>Is there a efficient way to load the images into a array.
  I had tried it with <code>for loop</code> but was not able to figure it out.</p>