ios - Swift:从现有的导航 Controller (如 Facebook 或 Snapchat)推送新的导航 Controller

标签 ios swift facebook uinavigationcontroller snapchat

如何从现有的导航 Controller 推送新的导航 Controller ,如下图所示的 Facebook 即时文章所做的那样?

在这种情况下,您是否必须创建一个 View Controller 架构,其中包含一个主导航 Controller 和一个半透明的导航栏,该导航栏同时包裹着 Facebook 标签栏/导航 Controller 和即时文章导航 Controller ?

Facebook instant article

编辑:添加了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/

相关文章:

ios - 如何在一个 UIViewController 中禁用 SWRevealViewController 滑动

ios - 应用程序存储分配和低存储通知

ios - 控制台上打印 NSLog 符号?

电子邮件客户端 Thunderbird 中的 Facebook 邮件

facebook - DotNetOpenAuth 3.4 和 Facebook 作为身份提供商/可信提供商

facebook - 我应该想通过 java web 应用程序 (tomcat) 发布帖子

ios - 暂停播放时 MPNowPlayingInfoCenter react 不正确

ios - 为什么我在 iOS 上设置窗口背景颜色时蒙版的背景颜色会发生变化?

ios - 无法将类型 'Swift._ContiguousArrayStorage<Swift.AnyObject>' 的值转换为 'NSMutableArray'

ios - 创建您的应用程序的链接以供其他应用程序启动