iOS 左上角后退按钮没有可见的导航栏
iOS top left back button without visible navigation bar
我正在 Xcode 11.1 中使用 UIKit 和故事板开发 iOS 应用程序。
我有一个包含全屏 MKMapView
的 ViewController
(嵌入在 Navigation Controller
中)。我很希望这个MKMapView
尽可能多的space,所以我选择隐藏Navigation Controller
的导航栏。但是从 View Controller
我推了另一个 View Controller
,但是由于导航栏被隐藏,这个推的 View Controller
在左上角没有后退按钮,因为之前的 View Controller
有没有/一个隐藏的导航栏。
如何使被推 View Controller
上的后退按钮可见,而不必使被推 View Controller
上的导航栏可见?
我不想对第二个按钮进行硬编码,按下 View Controller
,因为它也被其他 View Controller
访问,它们有一个可见的导航栏,因此后退按钮是为他们展示
这是显示我的设置的小图。
将此添加到包含 MKMapView 且没有导航栏的视图控制器:
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}
我正在 Xcode 11.1 中使用 UIKit 和故事板开发 iOS 应用程序。
我有一个包含全屏 MKMapView
的 ViewController
(嵌入在 Navigation Controller
中)。我很希望这个MKMapView
尽可能多的space,所以我选择隐藏Navigation Controller
的导航栏。但是从 View Controller
我推了另一个 View Controller
,但是由于导航栏被隐藏,这个推的 View Controller
在左上角没有后退按钮,因为之前的 View Controller
有没有/一个隐藏的导航栏。
如何使被推 View Controller
上的后退按钮可见,而不必使被推 View Controller
上的导航栏可见?
我不想对第二个按钮进行硬编码,按下 View Controller
,因为它也被其他 View Controller
访问,它们有一个可见的导航栏,因此后退按钮是为他们展示
这是显示我的设置的小图。
将此添加到包含 MKMapView 且没有导航栏的视图控制器:
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}