title: Add image icon to a UIPickerView row
body: <p>I have looked and looked on the net and not found much on this!</p>
  
  <p>I would like to know how you put images in a UIPicker so that each of the rows have a different image.</p>
  
  <pre><code>    #import "ViewController.h"
  
      @interface ViewController ()
  
      @end
  
      @implementation ViewController
      @synthesize pickerContent;
  
      @synthesize p1;
  
  
      - (void)viewDidLoad
      {
          [super viewDidLoad];
          // Do any additional setup after loading the view, typically from a nib.
      }
  
      - (void)didReceiveMemoryWarning
      {
          [super didReceiveMemoryWarning];
          // Dispose of any resources that can be recreated.
      }
  
  
      //////////
  
      - (NSMutableArray *)pickerContent
      {
          if(!pickerContent) {
              pickerContent = [[NSMutableArray alloc] initWithObjects:
                                [UIImage imageNamed:@"one.jpg"],
                                [UIImage imageNamed:@"two.jpg"],
                                [UIImage imageNamed:@"three.jpg"],
                                [UIImage imageNamed:@"four.jpg"],
                                [UIImage imageNamed:@"five.jpg"], nil];
          }
          return pickerContent;
      }
  
  
      - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
      {
          if ([pickerView isEqual:p1])
          {
              return 4;
          }
  
              return 0;
  
      }
      - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
      {
  
  
          if ([pickerView isEqual:p1])
          {
              if (component == R1)return [self.pickerContent count];
              if (component == R2)return [self.pickerContent count];
              if (component == R3)return [self.pickerContent count];
              if (component == R4)return [self.pickerContent count];
          }
  
          return 0;
      }
  
      - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
      {
          if ([pickerView isEqual:p1])
          {
              if (component== R1)return [pickerContent objectAtIndex:row];
              if (component== R2)return [pickerContent objectAtIndex:row];
              if (component== R3)return [pickerContent objectAtIndex:row];
              if (component== R4)return [pickerContent objectAtIndex:row];
          }
  
       return 0;
  
      }
      @end
  </code></pre>