1

How can one push a new navigation controller from an existing navigation controller, as is done for Facebook's instant articles pictured below?

In this case, would you have to create a view controller schema with a master navigation controller with a translucent navigation bar that wraps both the Facebook tab bar / navigation controller and the instant article navigation controller?

Facebook instant article

Edit: Added Snapchat example

aak
  • 67
  • 6

1 Answers1

0

Are you thinking of the different UINavigationBar rather than the UINavigationController? I think you can already change the bar appearance for a different UIViewController... if its being a problem then you can make a class for the UINavigationController and add functionality in there to change appearance of the bar for what ever the UIViewController is being viewed.

The delegate methods of the UINavigationController give you methods like

func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool)

Inside that you can put a check like

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
}
  • Thanks for your response Taimoor. However, I don't believe I'm referring to the UINavigationBar. In the above Facebook example and in the example below from Snapchat, it appears as though an entirely new UINavigationController is pushed to the existing one. https://postimg.org/image/owthr1vqj/ – aak Dec 13 '17 at 16:24
  • Well your images show back-swiping in progress... Which is done to pop viewcontrollers inside a navigationController (https://developer.apple.com/documentation/uikit/uinavigationcontroller/1621847-interactivepopgesturerecognizer)... remember that navigationController is the stack of view controllers onto which you can push and pop viewcontrollers... Are you sure its the NavigationController you're referring to? Or are you looking for the swipe to pop mechanism? i linked that in this comment. – Taimoor Abdullah Khan Dec 14 '17 at 06:28
  • Hi Taimoor, sorry I missed your quick follow up. My understanding of the iOS navigation stack was quite limited at the time of asking the above question. The `UINavigationController` delegate methods should indeed work – aak Mar 21 '18 at 23:45
  • Glad i could help. – Taimoor Abdullah Khan Mar 22 '18 at 06:47