title: Trying to display array of images, code returns iphone to home screen
body: <p>Here is the problem code:</p>
  
  <p>The code is to display an array of images which can then be scrolled through.</p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
  
      NSArray *photos = [[NSArray arrayWithObjects:   
                          [UIImage imageNamed:@"Event.png"],
                          [UIImage imageNamed:@"Logo.png"],
                          [UIImage imageNamed:@"default.png"],
                          [UIImage imageNamed:@"LittleLogoImage.png"],
                          nil] retain];      // TODO – fill with your photos
  
      // note that the view contains a UIScrollView in aScrollView
  
      int i=0;
      int width = 0;
      int height = 0;
      for ( NSString *image in photos )
      {
          UIImage *image = [UIImage imageNamed:[photos objectAtIndex:i]];
          UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
          imageView.contentMode = UIViewContentModeScaleAspectFit;
          imageView.clipsToBounds = YES;
  
          imageView.frame = CGRectMake( imageView.frame.size.width * i++, 0, imageView.frame.size.width, imageView.frame.size.height);
  
          [aScrollView addSubview:imageView];
          width = imageView.frame.size.width;
          height = imageView.frame.size.height;
  
          [imageView release];
      }
      aScrollView.contentSize = CGSizeMake(width*i, height);
      aScrollView.delegate = self;
  }
  </code></pre>
  
  <p>Any ideas?</p>
  
  <blockquote>
    <p>[Session started at 2011-05-07
    22:46:47 +0100.] 2011-05-07
    22:46:49.314 ALPHA[1171:207] load01
    2011-05-07 22:47:13.749
    ALPHA[1171:207] 2 2011-05-07
    22:47:13.751 ALPHA[1171:207] dealloc01
    2011-05-07 22:47:13.755
    ALPHA[1171:207] load02 2011-05-07
    22:47:19.791 ALPHA[1171:207] 4
    2011-05-07 22:47:19.792
    ALPHA[1171:207] dealloc02 2011-05-07
    22:47:19.795 ALPHA[1171:207] -[UIImage
    length]: unrecognized selector sent to
    instance 0x4b20f60 2011-05-07
    22:47:19.797 ALPHA[1171:207] <strong>*
    Terminating app due to uncaught
    exception
    'NSInvalidArgumentException', reason:
    '-[UIImage length]: unrecognized
    selector sent to instance 0x4b20f60'
    *</strong> Call stack at first throw: (  0   CoreFoundation<br>
    0x00dca5a9 <strong>exceptionPreprocess + 185
      1   libobjc.A.dylib<br>
    0x00f1e313 objc_exception_throw + 44
      2   CoreFoundation<br>
    0x00dcc0bb -[NSObject(NSObject)
    doesNotRecognizeSelector:] + 187  3<br>
    CoreFoundation<br>
    0x00d3b966 __<em>forwarding</em></strong> + 966     4<br>
    CoreFoundation<br>
    0x00d3b522 _CF_forwarding_prep_0 + 50
      5   UIKit<br>
    0x003e3568 _UIImageAtPath + 36    6<br>
    ALPHA<br>
    0x000037fd -[PhotosView viewDidLoad] +
    597   7   UIKit<br>
    0x0036a089 -[UIViewController view] +
    179   8   ALPHA<br>
    0x00002af3 -[ALPHAViewController
    displayView:] + 500   9   ALPHA<br>
    0x00002707 -[ALPHAAppDelegate
    displayView:] + 60    10  ALPHA<br>
    0x00002cdd -[View2 viewPhotos:] + 99
      11  UIKit<br>
    0x002ba4fd -[UIApplication
    sendAction:to:from:forEvent:] + 119
      12  UIKit<br>
    0x0034a799 -[UIControl
    sendAction:to:forEvent:] + 67     13 
    UIKit<br>
    0x0034cc2b -[UIControl(Internal)
    _sendActionsForEvents:withEvent:] + 527   14  UIKit<br>
    0x0034b7d8 -[UIControl
    touchesEnded:withEvent:] + 458    15 
    UIKit<br>
    0x002deded -[UIWindow
    _sendTouchesForEvent:] + 567  16  UIKit<br>
    0x002bfc37 -[UIApplication sendEvent:]
    + 447     17  UIKit                               0x002c4f2e _UIApplicationHandleEvent +
    7576  18  GraphicsServices<br>
    0x01722992 PurpleEventCallback + 1550
      19  CoreFoundation<br>
    0x00dab944
    <strong>CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION</strong>
    + 52  20  CoreFoundation                      0x00d0bcf7 __CFRunLoopDoSource1 + 215
      21  CoreFoundation<br>
    0x00d08f83 __CFRunLoopRun + 979   22 
    CoreFoundation<br>
    0x00d08840 CFRunLoopRunSpecific + 208
      23  CoreFoundation<br>
    0x00d08761 CFRunLoopRunInMode + 97    24
    GraphicsServices<br>
    0x017211c4 GSEventRunModal + 217  25 
    GraphicsServices<br>
    0x01721289 GSEventRun + 115   26  UIKit
    0x002c8c93 UIApplicationMain + 1160
      27  ALPHA<br>
    0x000026a8 main + 102     28  ALPHA<br>
    0x00002639 start + 53 )</p>
  </blockquote>
  
  <p>terminate called after throwing an instance of 'NSException'</p>
  
  <p>Thanks again,</p>
  
  <p>Jack</p>