make UILabel's text bold

后端 未结 6 1059
梦毁少年i
梦毁少年i 2021-01-31 01:32

I want to make UILabel\'s text bold

infoLabel=[[UILabel alloc]initWithFrame:CGRectMake(90,150, 200, 30)];
[infoLabel setText:@\"Drag 14 more Flavors\"];
[infoLab         


        
6条回答
  •  生来不讨喜
    2021-01-31 02:32

    Where possible I would suggest using dynamic font sizes to provide the best possible accessibility to your users.

    You can make a label use a system dynamic font and set it to have bold text by doing the following:

     exampleLabel.font = UIFont.preferredFont(forTextStyle: .body, compatibleWith: UITraitCollection(legibilityWeight: .bold))
    

提交回复
热议问题