开发者

How to change the font size in a UIPickerView? [duplicate]

开发者 https://www.devze.com 2023-03-07 13:53 出处:网络
This question already has answers here: 开发者_开发技巧 Closed 11 years ago. Possible Duplicate: UIPickerView Font…
This question already has answers here: 开发者_开发技巧 Closed 11 years ago.

Possible Duplicate:

UIPickerView Font…

I'm really stuck on this one problem in my application. I searched everywhere to no avail. How can I change the font size in a UIPickerView?


Implement viewForRow:forComponent: method in picker's data delegate, create UILabel instance in it with the font (and all other properties) you need, e.g.:

- (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);

0

精彩评论

暂无评论...
验证码 换一张
取 消