如何更改uipickerview标题文本中的字体样式?
问题描述:
更改uipickerview标题文本中的字体样式。 我想改变只有选定的标题行字体样式是粗体和其他标题文字是正常的font.change标题字体样式我想要的字体样式是Helvetica Neue Bold。如何更改uipickerview标题文本中的字体样式?
答
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
if(row == yourSelectedIndex)//to set as bold
{
UILabel* tView = (UILabel*)view;
if (!tView)
{
tView = [[UILabel alloc] init];
[tView setFont:[UIFont boldFontWithSize:14"]];
}
[email protected]"your text values";
return tView;
}
}
+0
不,它不工作 –
谢谢主席先生,但在这个环节上的所有pickerview粗体文字,我想唯一入选的标题的文字字体变化 –
检查与此http://stackoverflow.com/a/19825249/5362916 –
字体风格会更改NSAttributedString –