UIPicker中的UI字体大小未更改



我正试图用以下代码更改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;
}

我可以更改字体类型,但无论我输入什么值,字体大小都保持不变。有人知道为什么字体大小没有改变吗?非常感谢。

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

最新更新