【发布时间】:2019-11-23 20:43:59
【问题描述】:
我的view 有这个代码
struct ContentView: View {
var body: some View {
NavigationView{
List{
ForEach(0...5, id: \.self) { note in
VStack(alignment: .leading) {
Text("title")
Text("subtitle")
.font(.subheadline)
.foregroundColor(.secondary)
}
}
}
.navigationBarItems(trailing: resetButton)
.navigationBarTitle(Text("Notes"))
}
}
var resetButton: some View {
Button(action: {
print("reset")
}) {
Image(systemName: "arrow.clockwise")
}
.background(Color.yellow)
}
}
当我点击resetButton 时,似乎只有黄色区域会响应触摸。
如何使此按钮的可点击区域更大? (让它表现得像普通的UIBarButtonItem)
【问题讨论】: