When someone clicks on Notification, I want to show a view. However, I still want tabs visible at the bottom of the screen so they can go back to whatever tab they want.
当有人点击通知时,我想要显示一个视图。然而,我仍然希望选项卡在屏幕底部可见,这样他们就可以返回到他们想要的任何选项卡。
I tried adding invisible tabItem for notification and profile buttons but to show their views, I have to show them in the tabView as well which I don't want.
我尝试为通知和配置文件按钮添加不可见的表项,但要显示它们的视图,我必须在tabView中显示它们,这是我不想要的。
VStack {
HStack {
Spacer()
NavigationLink(destination: NotificationView()) {
Image(systemName: "bell")
.font(.title)
}
NavigationLink(destination: SettingsView()) {
Image(systemName: "person.circle")
.font(.title)
}
}
.padding(.horizontal, 20)
.padding(.bottom, -1)
TabView{
TimelineView()
.tabItem {
Image(systemName: "house")
Text("Home")
}
SearchView()
.tabItem {
Image(systemName: "magnifyingglass")
Text("Search")
}
CreateView()
.tabItem {
Image(systemName: "plus.circle")
Text("Create")
}
ReminderView()
.tabItem {
Image(systemName: "clock")
Text("Reminder")
}
ConversationView()
.tabItem {
Image(systemName: "message")
Text("Message")
}
}
.accentColor(.blue)
.padding(.bottom, -50)
}
更多回答
It sounds like you want to deep link from the notification into your app. You aren't talking about showing a sheet, just a view, which I presume is contained in one of your tabs. Deep linking is the way to go.
听起来你想要从通知深入链接到你的应用程序。您谈论的不是显示一个工作表,而是一个视图,我认为它包含在您的某个选项卡中。深度链接是必由之路。
In UIKit, once I got current selectedViewController and the navigation controller of that, after that I navigate to the page which I need.
在UIKit中,一旦我获得了当前的选定视图控制器和它的导航控制器,之后我就导航到我需要的页面。
优秀答案推荐
我是一名优秀的程序员,十分优秀!