如何更改UIPickerView中的字体大小?

时间:2011-05-23 08:59:09

标签: iphone uipickerview

  

可能重复:
  UIPickerView Font…

我真的在我的应用程序中遇到了这个问题。我到处搜索都无济于事。如何更改UIPickerView中的字体大小?

2 个答案:

答案 0 :(得分:15)

在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;
}

答案 1 :(得分:-1)

PickerView.transform = CGAffineTransformMakeScale(0.4,0.4);

相关问题