views:

101

answers:

0

hi, can anybody figure out why this is not working?? With the following code implemented text only appears in the first component but not in the second..... Thanks very much!

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view 
{
   UILabel *lbl = (UILabel *)view;
   // Reuse the label if possible...
   if ((lbl == nil) || ([lbl class] != [UILabel class])) {
       CGRect frame = CGRectMake(0.0, 0.0, 140, 32.0);
       lbl = [[[UILabel alloc] initWithFrame:frame] autorelease];   
   }   

   lbl.textColor = [UIColor blackColor];
   lbl.text = @"";
   lbl.backgroundColor = [UIColor clearColor];
   if (component == 0) {
      lbl.text = [exerciseTemplatesArray objectAtIndex:row];
      lbl.adjustsFontSizeToFitWidth = YES;
   }
   if (component == 1) {
      lbl.text = @"etst";
   }

   return lbl; 
}