美文网首页iOS Developer
iOS设置font weight

iOS设置font weight

作者: CrystalZhu | 来源:发表于2017-05-18 16:56 被阅读1696次

systemFontOfSize: weight:

前一个就是调整字体大小,主要说说后一个,以下的这些都是填入权重值(即weight:后)

UIFontWeightUltraLight  - 超细字体

UIFontWeightThin  - 纤细字体

UIFontWeightLight  - 亮字体

UIFontWeightRegular  - 常规字体

UIFontWeightMedium  - 介于Regular和Semibold之间

UIFontWeightSemibold  - 半粗字体

UIFontWeightBold  - 加粗字体

UIFontWeightHeavy  - 介于Bold和Black之间

UIFontWeightBlack  - 最粗字体(理解)

这是设置系统默认字体的weight

当然其他的字体也可以设置,比如HelveticaNeue,HelveticaNeue是iOS自带的字体。其中就包含了多种weight,我们只需要在使用时,选择不同的字体就可以达到类似于html一样设置weight的效果了。

比如:

titleLabel.font = UIFont.init(name: "HelveticaNeue-Medium", size: 17)    这里我们就是用了HelveticaNeue的Medium字体,跟上面相同Medium是介于Regular和Semibold之间的字体。

相关文章

网友评论

    本文标题:iOS设置font weight

    本文链接:https://www.haomeiwen.com/subject/iqgsxxtx.html