I trying to change the color of a single row thats been selected in a UIPickerView with a Toolbar Button connected to an IBAction but it doesn't like the 'label' and 'component' in the call to UIView *pickerView viewForRow. It thinks its undeclared. Also, it paints every row and I only want a single row painted - (I've tried it as a separate method). Here is the code:
-(IBAction) setParm { UIView *pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)rowforComponent:(NSInteger)component reusingView:(UIView *)view UILabel *label = (UILabel *) view; if (label == nil) { label = [[UILabel alloc] init];} [label setText:@"parameter set"]; [label setTextColor:[UIColor blackColor]]; [label setBackgroundColor: [UIColor colorWith [indent]Red:(CGFloat)0.376 green:(CGFloat)0.988 blue:(CGFloat)0.36 alpha:(CGFloat)0.50]; CGSize rowSize = [pickerView rowSizeForComponent:component]; CGRect labelrect = CGRectMake(0, 0, rowSize.width, rowSize.height); [label setFrame:labelrect]; }
-(IBAction) setParm { UIView *pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)rowforComponent:(NSInteger)component reusingView:(UIView *)view UILabel *label = (UILabel *) view; if (label == nil) { label = [[UILabel alloc] init];} [label setText:@"parameter set"]; [label setTextColor:[UIColor blackColor]]; [label setBackgroundColor: [UIColor colorWith [indent]Red:(CGFloat)0.376 green:(CGFloat)0.988 blue:(CGFloat)0.36 alpha:(CGFloat)0.50]; CGSize rowSize = [pickerView rowSizeForComponent:component]; CGRect labelrect = CGRectMake(0, 0, rowSize.width, rowSize.height); [label setFrame:labelrect]; }