我能够改变我的字体颜色,但我还需要更改字体大小,我该如何实现?这是我的颜色代码,
- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component {
NSString *title = _currencyName[row];
NSAttributedString *attString = [[NSAttributedString alloc] initWithString:title attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
return attString;
}
Run Code Online (Sandbox Code Playgroud)
更新:这不起作用:
NSAttributedString *attString = [[NSAttributedString alloc] initWithString:title attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-Light" size:40]}];
Run Code Online (Sandbox Code Playgroud)