我正在开发我的第一个 iOS 应用程序。
我使用的是 Xcode 11.3 和 Swift5
我不确定是否可行,当我在 NavigationLink 中按后退按钮时可以添加操作吗?
(In this picture, the back button is 'Bibles' button.)
NavigationLink(destination: VerseList(bible: self.bible, chapter: c.chapter)){
ChapterRow(chapter: c.chapter)
}.navigationBarTitle("Chapters")
这是我的代码。我想添加“ Action ”..
有更好的方法吗?
最佳答案
我认为更有可能是这样。
NavigationLink(destination:VerseList(bible: self.bible, chapter: c.chapter)
.onDisappear {
// put action here
}
){ChapterRow(chapter: c.chapter)}
.navigationBarTitle("Chapters")
关于ios - 当我在 SwiftUI 中按下导航后退按钮时,可以添加一些操作吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59912470/