我想要按钮与 iOS 中的“提醒”应用程序完全相同,下面的代码注释可以正常工作,我还尝试使用标签和系统图像名称。
.toolbar {
ToolbarItem(placement: .bottomBar) {
Button(action: {}, label: {
HStack {
Image(systemName: "plus.circle.fill")
Text("New Reminder")
}
})
}
}
Run Code Online (Sandbox Code Playgroud)
小智 1
创建自定义标签样式
struct VerticalLabelStyle: LabelStyle {
func makeBody(configuration: Configuration) -> some View {
VStack {
configuration.icon.font(.headline)
configuration.title.font(.footnote)
}
}
}
Run Code Online (Sandbox Code Playgroud)
然后您可以为标签使用自定义样式
Button(action: {}, label: {
Label("Home", systemImage: "house")
.labelStyle(VerticalLabelStyle())
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1751 次 |
| 最近记录: |