UIFont大小在UIPicker中没有变化

时间:2015-02-18 14:47:10

标签: ios uipickerview uifont

我尝试使用以下代码更改UIPicker中元素的字体和大小:

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{

    UILabel *pickerViewLabel = (id)view;

    if (!pickerViewLabel) {
        pickerViewLabel= [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [pickerView rowSizeForComponent:component].width - 10.0f, [pickerView rowSizeForComponent:component].height)];
    }

    pickerViewLabel.backgroundColor = [UIColor clearColor];
    pickerViewLabel.text = _startTimeArray[row];
    pickerViewLabel.font = [UIFont fontWithName:@"Helvetica Neue Regular" size:(22)];

    return pickerViewLabel;
}

我能够改变字体的类型,但无论我输入什么值,大小都保持不变。有谁知道为什么字体大小没有改变?谢谢!

1 个答案:

答案 0 :(得分:0)

您使用了错误的字体名称。试试HelveticaNeue。 您可以找到所有可用的字体名称here

相关问题