Using cached images in UItableView
<p>using iOS 4.1 SDK. I am using 2 small images in each row of a UITableView. I wanted to know which of the following 2 methods was better, also is Method 1 valid at all?</p>

<pre><code>- (void)viewDidLoad 
{
   // create the images amd assign to class member variable
   NSString *imgStr1 = [[NSBundle mainBundle] pathForResource:@"someImg1"                                                                         
                                                     ofType:@"png"];
   UIImage* img1 =  [[UIImage alloc] initWithContentsOfFile:imgStr];
   self.image1 = img1;
   [img1 release];

   NSString *imgStr2 = [[NSBundle mainBundle] pathForResource:@"someImg2"                                                                         
                                                     ofType:@"png"];
   UIImage* img2 =  [[UIImage alloc] initWithContentsOfFile:imgStr2];
   self.image2 = img2;
   [img2 release];


}

  - (UITableViewCell *)tableView:(UITableView *)tableView 
     cellForRowAtIndexPath:(NSIndexPath *)indexPath 
 {
    static NSString *cellIdentifier = @"cellIdentifier";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: 
                         cellIdentifier];
    if (cell == nil) 
    {

       //create image views here
       ..........................
     }

    / assign images from viewDidLoad to imageView here
     UIImageView *img1View = (UIImageView *)[cell viewWithTag:kImg1Tag];
     [img1View setImage:self.img1];
     etc....
  }
</code></pre>

<p>OR should i just do this in the cellForRowAtIndexPath </p>

<pre><code>    [img1View setImage:[UIImage imageNamed:@"img1.png"];
</code></pre>
