如果我有一个UIFont对象,是否可以将其转换为粗体?我不知道字体名称,我只有一个UIFont对象.我想要的是一个像这样的功能
UIFont *boldFontFromFont(UIFont *input)
{
return [input derivedFontWithFontWeight:UIFontWeightBold];
}
Run Code Online (Sandbox Code Playgroud)
如何更改代码以使其正常工作.(上面的代码不起作用,我只是说明了这一点.)
提前致谢.
我的应用程序中有以下代码.
tmp=[[UILabel alloc] initWithFrame:label1Frame];
tmp.tag=1;
tmp.textColor=[UIColor blackColor];
[tmp setFont:[UIFont fontWithName:@"American Typewriter" size:18]];
tmp.backgroundColor=[UIColor clearColor];
[cell.contentView addSubview:tmp];
[tmp release];
Run Code Online (Sandbox Code Playgroud)
现在,我需要知道,
======>如何通过代码设置"Typeface = bold"?