Mal*_*cia 1 fonts font-size uifont ios swift
我在我的项目中导入我的字体
我创建了一个class style.swift
struct Style {
//fonts
static var GothamBlackItalic = UIFont(name: "Gotham-BlackItalic.ttf", size: 12)
static var GothamBold = UIFont(name: "Gotham-Bold.ttf", size: 12)
static var GothamBoldItalic = UIFont(name: "Gotham-BoldItalic.ttf", size: 12)
static var GothamBook = UIFont(name: "Gotham-Book.ttf", size: 12)
static var GothamBookItalic = UIFont(name: "Gotham-BookItalic.ttf", size: 12)
static var GothamLight = UIFont(name: "Gotham-Light.ttf", size: 12)
static var GothamLightItalic = UIFont(name: "Gotham-LightItalic.ttf", size: 12)
static var GothamMedium = UIFont(name: "Gotham-Medium.ttf", size: 4)
static var GothamMediumItalic = UIFont(name: "Gotham-MediumItalic.ttf", size: 12)
static var GothamThin = UIFont(name: "Gotham-Thin.ttf", size: 12)
static var GothamThinItalic = UIFont(name: "Gotham-ThinItalic.ttf", size: 12)
static var GothamUltra = UIFont(name: "Gotham-Ultra.ttf", size: 12)
static var GothamUltraItalic = UIFont(name: "Gotham-UltraItalic.ttf", size: 12)
static var GothamExtraLight = UIFont(name: "Gotham-XLight.ttf", size: 12)
static var GothamExtraLightItalic = UIFont(name: "Gotham-XLightItalic.ttf", size: 12)
}
Run Code Online (Sandbox Code Playgroud)
在我的视图控制器中,我在我的标签中调用字体GothamMedium:
myLabel.font=Style.GothamMedium
Run Code Online (Sandbox Code Playgroud)
字体是正确的但fontsize不起作用. 你能告诉我怎样才能改变字体大小?
你提到的font name和之间存在差异,而不是.双击字体,它将打开,标题是现在应该创建为font file namefont file namefont nameFont Bookfont namefont
static var GothamBlackItalic = UIFont(name: "Gotham Black", size: 12)
Run Code Online (Sandbox Code Playgroud)
另外加入Fonts provided by application你的plist.看到这个链接
| 归档时间: |
|
| 查看次数: |
952 次 |
| 最近记录: |