3

I have some VC which should push to ANOTHER Navigation Controller. If I do just

self.navigationController?.pushViewController(self.storyboard!.instantiateViewControllerWithIdentifier("someID") as someVC, animated: true)

this is not working. I can add

    dispatch_async(dispatch_get_main_queue()) { 
         self.navigationController?.pushViewController(self.storyboard!.instantiateViewControllerWithIdentifier("someID") as someVC, animated: true)
    }

So it works but as I know it's not correctly way to use it. What I should use? presentViewController ?

Max
  • 1,341
  • 3
  • 20
  • 39

1 Answers1

1

You should push only UIViewController subclasses inside a navigation controller. This question might help!

Community
  • 1
  • 1
dev_mush
  • 2,136
  • 3
  • 22
  • 38
  • as I see there recommend use presenetViewController – Max Sep 09 '14 at 08:14
  • yes, you could use "presentViewController" to present another View Controller, previously it was called "presentModalViewController", and it allowed you to present a view controller "modally". – dev_mush Sep 09 '14 at 08:17
  • just If I use "presentViewController" next VC work strange: without navigationBar etc. – Max Sep 09 '14 at 08:18
  • I'm sorry but the question you asked gives not enough information to understand your problem. – dev_mush Sep 09 '14 at 08:22
  • I've added presentViewControl to NavigationController which I need and this works without dispatch_async! But still one problem: it works without animation even I set animation: true – Max Sep 09 '14 at 11:29