Swiftui 加粗的快捷表
当我用SwiftUI呈现一张工作表时,所有内容都变得粗体。如果我轻扫一点,粗体字就会消失 例如:Swiftui 加粗的快捷表,swiftui,swiftui-form,Swiftui,Swiftui Form,当我用SwiftUI呈现一张工作表时,所有内容都变得粗体。如果我轻扫一点,粗体字就会消失 例如: .navigationBarItems(leading: Button(action:{ self.isSheetPresented.toggle() }) { Text("Display") } .frame(width: 25, height: 45) .sheet(isPresented: $isSheetPr
.navigationBarItems(leading:
Button(action:{
self.isSheetPresented.toggle()
}) {
Text("Display")
}
.frame(width: 25, height: 45)
.sheet(isPresented: $isSheetPresented) {
Textfield("Hello", text: $binding)
})
}
除了申请外,还有什么简单的解决办法吗
.fontWeight(.regular) or .font(.body)
什么都有
注:在MacOS 11.0 beta版(20A5395g)上运行Xcode版本12.2 beta 3(12B5035g)尝试将工作表移出navigationBarItems并附加到身体内部的某些视图,如
// ... other views
.navigationBarItems(leading:
Button(action:{
self.isSheetPresented.toggle()
}) {
Text("Display")
}
.frame(width: 25, height: 45)
)
...
} // end of NavigationView
.sheet(isPresented: $isSheetPresented) { // << here !!
Textfield("Hello", text: $binding)
}
/。。。其他观点
.navigationBarItems(领先:
按钮(操作:{
self.isSheetPresented.toggle()文件
}) {
文本(“显示”)
}
.框架(宽:25,高:45)
)
...
}//导航视图结束
.sheet(isPresented:$isSheetPresented){/好的,我做了一些测试:
.navigationBarItems(leading:
Button(action: {self.showingSettings = true}) {
Image(systemName: "gear")
}
//.sheet(isPresented: $showingAddItem, content: {
// AddView(expirations: self.expirations)
,
trailing:
Button(action: {self.showingAddItem = true}) {
Image(systemName: "plus")
}
//.sheet(isPresented: $showingSettings, content: {
// SettingsView()
)
.sheet(isPresented: $showingAddItem, content: {
AddView(expirations: self.expirations)
})
.sheet(isPresented: $showingSettings, content: {
SettingsView()
})
但是这样做,拖尾按钮不起作用,只有前导按钮我在SwiftUI中遇到一个绝对的、随机的错误的次数是难以置信的。瞧,把.sheet
移出导航项
解决了这个问题-真正的问题是为什么它一开始就是一个问题