How do I change the color of the text in a UIPickerView under iOS 7?

后端 未结 8 930
花落未央
花落未央 2020-11-30 19:39

I\'m aware of the pickerView:viewForRow:forComponent:reusingView method, but when using the view it passes in reusingView: how do I ch

8条回答
  •  孤城傲影
    2020-11-30 20:04

    - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {
            UILabel* pickerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, pickerView.frame.size.width, 37)];
            pickerLabel.text = @"text";
            pickerLabel.textColor = [UIColor redColor];
            return pickerLabel;
    }
    

提交回复
热议问题