- (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;
}ios中修改自定义PickerView的字体颜色
最新推荐文章于 2023-12-03 21:32:04 发布
本文介绍如何为UIPickerView设置自定义的单元格视图,并详细解释了UILabel的配置过程,包括字体大小调整等。
295

被折叠的 条评论
为什么被折叠?



