ios中修改自定义PickerView的字体颜色

xiaoxiao2021-02-28  81

- (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 setBackgroundColor:[UIColor clearColor]]; [pickerLabel setFont:[UIFont boldSystemFontOfSize:15]]; } // Fill the label text here pickerLabel.text=[self pickerView:pickerView titleForRow:row forComponent:component]; pickerLabel.textAlignment = NSTextAlignmentCenter; return pickerLabel; }
转载请注明原文地址: https://www.6miu.com/read-64240.html

最新回复(0)