SwiftUI的(XCODE:11.2.1)中没有用于文本字段的内置font-weight修饰符。如何在不将UITextField扩展为UIViewRepresentable的情况下引入字体粗细?
最佳答案
import SwiftUI
struct ContentView: View {
@State var TextValue: String = "Hello"
var body: some View {
VStack {
TextField("placeholder", text: $TextValue)
.padding(.horizontal, 50)
.font(.system(size: 30, weight: .heavy, design: .default))
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
关于ios - 如何在TextField swiftUI中加粗文本?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59150320/