xcode 如何在iphone应用程序中设置UIFont粗体

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11840456/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 01:09:22  来源:igfitidea点击:

how to set UIFont bold in iphone application

iphonexcodeuilabel

提问by user1567956

I want to set the font of UILabelto helvetica boldbut it just shows normal font.

我想将字体设置UILabelhelvetica 粗体,它只显示正常字体。

I am using below code

我正在使用下面的代码

UILabel *labelHeadingOne = [[UILabel alloc] initWithFrame:CGRectMake(22,260, 504, 20)];
labelHeadingOne.backgroundColor = [UIColor clearColor];

labelHeadingOne.font=[UIFont fontWithName:@"Helvetica" size:16];

labelHeadingOne.text=@"Pre-emergent herbicide with residual control for warm-season turf";

回答by rob mayoff

You can use the font name Helvetica-Bold. Check out http://iosfonts.com/for the full list.

您可以使用字体名称Helvetica-Bold。查看http://iosfonts.com/以获取完整列表。

回答by Hemant Dixit

Use this :

用这个 :

  labelHeadingOne.font=[UIFont fontWithName:@"Helvetica-Bold" size:16];

回答by Jonas T?rnqvist

Use this;

用这个;

[UIFont boldSystemFontOfSize:16];