您的位置:首页 > 移动开发 > IOS开发

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

2016-11-19 16:31 447 查看
- (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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息