0

I have a very simple story board here. There is no code involved in this yet. The problem I am having is that when I change the transition to "Flip Horizontal" the text fields get disabled for some reason (i.e. clicking on the text field does not bring up the keyboard). This is triggered when with the following sequence: click on text field keyboard pops up -> hit next -> click on text field keyboard pops up -> hit back click on text field -> keyboard no longer pops up After that going between the screens and clicking on text fields does not work (i.e. the keyboard doesn't pop up). It works fine if I use default transition.

Any ideas on why this is happening?

Community
  • 1
  • 1
Naveed
  • 2,942
  • 2
  • 25
  • 58

1 Answers1

1

I'm not sure this is your problem, but your storyboard setup is wrong. It looks like you're going back and forth with modal segues. Every time you do that you're creating a new instance of the view controller you're going to, so you're piling up more and more controllers, none of which ever gets deallocated. Unless you're using an unwind segue, you should never go backwards in a storyboard with segues. So, when going from the controller you show on the right back to ViewController, you should just use [self dismissViewControllerAnimated:completion:] in code, and get rid of the segue.

rdelmar
  • 103,982
  • 12
  • 207
  • 218
  • I am still learning iOS development. My understanding was that once you transition from one view to another using modal segues, all the resources of the previous view were discarded immediately so creating a new instance wont create a pile but I guess that is no the case. What is the recommended way of doing this kind of navigation? Essentially once you leave the view I wan't all the resources to be destroyed. I have android background and there are ways that lets you specify if you'd want an activity to stay in back stack or be destroyed on transition. Is there something similar here? – Naveed Jul 28 '13 at 01:27
  • @NaveedKhan, when you dismiss a modal view controller, it will be deallocated, unless you keep a strong reference to it. The same goes for when you pop a view controller off a navigation controller's stack. There's no way to have the source view controller of a modal or push segue be deallocated. In the case of a modal, that source controller is still the window's root view controller, and in the case of the push, the source controller is still on the navigation controller's stack. If you want the source view controller of a transition to be deallocated, you'll have to change... (cont. below) – rdelmar Jul 28 '13 at 04:39
  • the window's root view controller, and do the animation yourself. – rdelmar Jul 28 '13 at 04:40
  • Can you please look at this question: http://stackoverflow.com/questions/17905552/clearing-back-stack-on-transition – Naveed Jul 29 '13 at 02:54