如何在UIPickerView中更改字体大小? [重复]

问题描述

|                                                                                                                   这个问题已经在这里有了答案:                                                      

解决方法

在picker的数据委托中实现
viewForRow:forComponent:
方法,并在其中使用所需的字体(和所有其他属性)创建UILabel实例,例如:
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
    UILabel* tView = (UILabel*)view;
    if (!tView){
        tView = [[UILabel alloc] init];
            // Setup label properties - frame,font,colors etc
            ...
    }
    // Fill the label text here
    ...
    return tView;
}
    ,PickerView.transform = CGAffineTransformMakeScale(0.4,0.4);