我有一个包含 5 个元素和一个取消按钮的操作表。我正在尝试将取消按钮设置为红色,但它不起作用。我已经看到这个SwiftUI ActionSheet 每个动作都有不同的颜色。破坏性按钮样式使其他选项卡变为红色,但不知道如何将取消选项卡变为红色。我已将我的取消选项卡更新为以下,但颜色仍然是蓝色,任何建议都会很棒。
.cancel(Text("Cancel")
.font(.system(size: 40.0))
.foregroundColor(Color.red))
下面是我的 ActionSheet 代码:
.actionSheet(isPresented: $showLocationOptions) {
ActionSheet(title: Text("Which city/town is this place in ?"), message: Text("Select a location"), buttons: [
.default(Text(location1)) { },
.default(Text(location2)) { },
.default(Text(location3)) { },
.default(Text(location4)) { },
.default(Text(location5)) { },
.cancel(Text("Cancel")
.font(.system(size: 40.0))
.foregroundColor(Color.red))
])
}