在我的 SwiftUI 專案中,我有一個占位符,我想成為 .heavy,但是當我嘗試修改 fontWeight 時,它說 fontWeight 是在 Text 上定義的,我該怎么辦?
這是代碼:
TextField("", text: $MyModel.name[0])
.placeholder(when: MyModel.name[0].isEmpty) {
Text(player1)
.font(Font.custom("Life Savers", size: 26))
.fontWeight(.bold)
}
.font(Font.custom("Life Savers", size: 26))
//here it doesn't let me change the fontWeight to heavy
uj5u.com熱心網友回復:
供TextField你使用
.font(Font.custom("Life Savers", size: 26).weight(.heavy))
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/466283.html
