如何更改警报中按钮的颜色和 NavigationLink 中后退按钮的颜色?.accentColor(.init("someColor"))在警报按钮的文本不起作用之后进行设置。设置.accentColor(.init("someColor"))后的navigationLink也不起作用。我能做些什么?
struct ContentView: View {\n \n @State var showSheet = false\n @State var alertShouldBeShown = !UserDefaults.standard.bool(forKey: "\xc2\xa3Start")\n\n var body: some View {\n Button(action: {\n self.showSheet.toggle()\n }) {\n Text("click me")\n //.accentColor(colorScheme == .dark ? Image("") : Image("Info-Icon"))\n }.sheet(isPresented: $showSheet) {\n SheetView(showSheet: self.$showSheet)\n }\n .alert(isPresented: $alertShouldBeShown, content: {\n\n Alert(title: Text("Headline"),\n message: Text("Text"),\n dismissButton: Alert.Button.default(\n Text("Ok"), action: {\n UserDefaults.standard.set(true, forKey: "Start")\n }\n )\n )\n })\n }\n}\n\nstruct SheetView: View {\n @Binding var …Run Code Online (Sandbox Code Playgroud) 我是 SwiftUI 的新手,我想在用户第一次启动应用程序时显示警报。如果用户第二次(或第三次...)打开应用程序,则不应再出现警报。
struct ContentView: View {
@State var alertShouldBeShown = true
var body: some View {
VStack {
Text("Hello World!")
.alert(isPresented: $alertShouldBeShown, content: {
Alert(title: Text("Headline"),
message: Text("Placeholder"),
dismissButton: Alert.Button.default(
Text("Accept"), action: {
}
)
)
})
}
}
}
Run Code Online (Sandbox Code Playgroud) I\xc2\xb4m 是 SwiftUI 中的新功能。我想知道当用户按下应用程序中的按钮时,如何从 iPhone 打开设置应用程序中的应用程序设置。
\n