iOS-修改PickerItem文字大小颜色等

  • (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
UILabel* pickerLabel = (UILabel*)view;
if (!pickerLabel){
    pickerLabel = [[UILabel alloc] init];
    // Setup label properties - frame, font, colors etc
    //adjustsFontSizeToFitWidth property to YES
    pickerLabel.adjustsFontSizeToFitWidth = YES;
    [pickerLabel setTextAlignment:NSTextAlignmentCenter];
    [pickerLabel setTextColor:ColorString0xColor(0x333333)];
    [pickerLabel setFont:[UIFont boldSystemFontOfSize:14]];
}
// Fill the label text here
pickerLabel.text=[self pickerView:pickerView titleForRow:row forComponent:component];
return pickerLabel;

}

你可能感兴趣的:(iOS-修改PickerItem文字大小颜色等)