title: MKNetworkKit - displaying cached images
body: <p><strong>UPDATE AT BOTTOM</strong></p>
  
  <p>I branched off of the MKNetworkKit Flickr demo for this. I have several images on a webserver I want to display in a table.  I have a UITableViewCell subclass, ImageCell.</p>
  
  <p>Here is the custom method for retrieving remote images:</p>
  
  <pre><code>-(void)setImageForCell:(NSString *)remoteFileName {
  
      self.loadingImageURLString =
      [NSString stringWithFormat:@"http://myserver.com/%@.png",remoteFileName];
      self.imageLoadingOperation = [ApplicationDelegate.imageDownloader imageAtURL:[NSURL URLWithString:self.loadingImageURLString]
                              onCompletion:^(UIImage *fetchedImage, NSURL *url, BOOL isInCache) {
  
                                  if([self.loadingImageURLString isEqualToString:[url absoluteString]]) {
  
                                      if (isInCache) {
                                          self.imageView.image = fetchedImage;
                                          [self.contentView drawRect:self.contentView.frame];
                                          NSLog(@"Image is in cache");
                                      } else {
                                          self.imageView.image = fetchedImage;
                                          [self.contentView drawRect:self.contentView.frame];
                                          NSLog(@"Image is not in cache");
                                      }
                                  }
                              }];   
  }
      //TableView.h
      //it is called like this
     //in cellForRowAtIndexPath...
     ImageCell *cell = (ImageCell *)[tableView dequeue...etc];
   MyObject *obj = [dataSource objectAtIndex:indexPath.row];
   cell.textLabel.text = obj.name;
   [cell setImageForCell:obj.name];
   return cell;
  </code></pre>
  
  <p>I have inspected the contents of my default cache directory, and there are now items inside.  Scrolling the table constantly now prints "Image is in cache".  The problem is, the cell's imageView never updates.  Mugunth has a class method automaticallyNotifiesObserversForKey: but I don't ever see it implemented anywhere.  I'm guessing that there's another step involved to tell the tableView instance to update that row with the new contents.</p>
  
  <p>Thanks for your input.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I got this to work by using a custom Interface Builder xib file with a Cell and a UIImageView IBOutlet. Not sure why it wasn't working with self.imageView.image, and would be interested to find out why, exactly. I still consider this an open question because I'd like to just use the standard UITableViewCell class.</p>