2021年4月3日星期六

Strange issue with NavigationView on iPad (SwiftUI)

I have used NavigationView like this for iPhone and iPad, and in iPhone works fine. But for iPad, sometimes when enter a NavigationLink - it will go to the new view, then enter the same view again... and again for a few times!

NavigationView {    WidgetEditor(widgetSize: $widgetSize)      .navigationBarTitle("", displayMode: .inline)      .toolbar {        ToolbarItem(placement: .navigationBarLeading) {          NavigationLink(destination: AppsView()) {                          ...          }        }                          ToolbarItem(placement: .navigationBarTrailing) {          NavigationLink(destination: HelpView()) {            Image(systemName: "questionmark.circle")          }        }     }  }  .navigationViewStyle(StackNavigationViewStyle())  

I suspect it is the last line that cause the issue, but I need the NavigationView to looks like iPhone not dual panes. Any suggestions? Thanks in advance!

https://stackoverflow.com/questions/66937928/strange-issue-with-navigationview-on-ipad-swiftui April 04, 2021 at 12:05PM

没有评论:

发表评论