[英]I want to hide the navigation bar and display only the back button in SwiftUI
[英]Can I add some action when I push the Navigation back button in SwiftUI?
我正在開發我的第一個 ios 應用程序。
我正在使用 Xcode 11.3 和 Swift5
我不確定是否可行,我可以在 NavigationLink 中按下后退按鈕時添加一個動作嗎?
NavigationLink(destination: VerseList(bible: self.bible, chapter: c.chapter)){
ChapterRow(chapter: c.chapter)
}.navigationBarTitle("Chapters")
這是我的代碼。 我想添加“動作”..
有沒有更好的方法來做到這一點?
我認為更有可能是這樣。
NavigationLink(destination:VerseList(bible: self.bible, chapter: c.chapter)
.onDisappear {
// put action here
}
){ChapterRow(chapter: c.chapter)}
.navigationBarTitle("Chapters")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.