title: iOS/iPhone :UIView not adding elements for NSMutableArray (containing UILabel objects)
body: <p>I have a <strong>UIView</strong> in which i have written the following method:</p>
  
  <pre><code>- (void)drawLabels:(NSMutableArray*)labelArray{
    for (int i=0; i&lt;[labelArray count]; i++) {        
      CGRect labelFrame = CGRectMake(0, 0, 50, 50);
      labelFrame = CGRectInset(labelFrame, 5, 5);
      UILabel *label = (UILabel*)[labelArray objectAtIndex:i];
      [self addSubview:label];    
  </code></pre>
  
  <p>}</p>
  
  <p>The code crashes with the following error :</p>
  
  <blockquote>
    <p>-[UIDeviceRGBColor superview]: unrecognized selector sent to instance 0x6e397c0
    2012-11-27 18:37:33.559 QuartzSample[57621:f803] <strong>* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDeviceRGBColor superview]: unrecognized selector sent to instance 0x6e397c0'
    *</strong> First throw call stack:
    (0x13cf022 0x1560cd6 0x13d0cbd 0x1335ed0 0x1335cb2 0x55e4f 0x5014b 0x4398 0x38a1 0xe0a1e 0x3f401 0x3f670 0x3f836 0x4672a 0x292b 0x17386 0x18274 0x27183 0x27c38 0x1b634 0x12b9ef5 0x13a3195 0x1307ff2 0x13068da 0x1305d84 0x1305c9b 0x17c65 0x19626 0x2632 0x25a5)
    terminate called throwing an exception(lldb) </p>
  </blockquote>
  
  <p>I wish to place the labels on the view with all the formatting(color, font,size,etc.).
  Also when i put the following code :</p>
  
  <pre><code>NSLog(@"%@",[labelArray objectAtIndex:i]);
  </code></pre>
  
  <p>i get the following in console:
    <strong>UIDeviceRGBColorSpace 0 1 0 0.3</strong></p>
  
  <p>Can anybody elaborate ?</p>