首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

UIPickerView控件中自定义展示的字体大小及样式

2012-12-22 
UIPickerView控件中自定义显示的字体大小及样式通过覆盖如下方法实现- (UIView *)pickerView:(UIPickerVie

UIPickerView控件中自定义显示的字体大小及样式

通过覆盖如下方法实现

- (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.minimumFontSize = 8.;        pickerLabel.adjustsFontSizeToFitWidth = YES;        [pickerLabel setTextAlignment:UITextAlignmentLeft];        [pickerLabel setBackgroundColor:[UIColor clearColor]];        [pickerLabel setFont:[UIFont boldSystemFontOfSize:15]];    }    // Fill the label text here    pickerLabel.text=[self pickerView:pickerView titleForRow:row forComponent:component];    return pickerLabel;}
?

?

热点排行