如何从现有的导航 Controller 推送新的导航 Controller ,如下图所示的 Facebook 即时文章所做的那样?
在这种情况下,您是否必须创建一个 View Controller 架构,其中包含一个主导航 Controller 和一个半透明的导航栏,该导航栏同时包裹着 Facebook 标签栏/导航 Controller 和即时文章导航 Controller ?
编辑:添加了Snapchat例子
最佳答案
您是否在考虑不同的 UINavigationBar
而不是 UINavigationController
?我认为您已经可以为不同的 UIViewController
更改栏外观...如果它有问题,那么您可以为 UINavigationController
创建一个类并在其中添加功能根据正在查看的 UIViewController
更改栏的外观。
UINavigationController
的委托(delegate)方法为您提供类似
func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool)
在里面你可以放一个支票
if viewController.isKind(of: SomeViewController.self) {
//make this specific change for it
} else if viewController.isKind(of: SomeOtherViewController.self) {
//make this specific change for this other viewController
} else {
//make this for all other
}
关于ios - Swift:从现有的导航 Controller (如 Facebook 或 Snapchat)推送新的导航 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47543441/