0

I have got this simple code in my Swift code

let PostPage = PostView() navigationController?.pushViewController(PostPage, animated: true) class PostView: UIViewController 

And this code does what it's supposed to do,which is to show PostView,but when this view is shown i expect that UINavbar's title will be changed and the back button will be shown.But none of that happens

enter image description here enter image description here

in AppDelegate

window?.rootViewController = UINavigationController(rootViewController: TabNavigator()) 
22
  • 1
    What does appear? Commented Aug 7, 2017 at 19:56
  • @NRitH PostView with UINavbar Commented Aug 7, 2017 at 19:57
  • What VC was shown before the push? Commented Aug 7, 2017 at 20:00
  • The VC in which i call let PostPage = PostView() navigationController?.pushViewController(PostPage, animated: true) Commented Aug 7, 2017 at 20:01
  • can you share the code what you are doing before pushing the PostView controller. also the screen shot of before + after the push? Commented Aug 7, 2017 at 20:03

1 Answer 1

3

It seems like you are changing the rootViewController from NavigationController to a ViewController.

let homeTab = UINavigationController(rootViewController:HomePage()) self.viewControllers = [homeTab] 

Thus the rootViewController is no longer a navigationController.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.