0

I am using a SWreveal view controller whichs displays a list in a table view. I call this from View Controller A when user uses a gesture. When i select a row in the table view. View controller A is created again and displayed instead of showing the previous View controller A.. View controller A's View did load method is being called rather than calling View did appear

iOSDeveloper
  • 461
  • 4
  • 20

1 Answers1

1

The problem is that you've configured your storyboard incorrectly. You're using a segue to go from the table view to the SWReveal view controller. A segue creates a new view controller, so you're seeing a new view controller. Thus you end up with three view controllers:

  • The original SWReveal view controller

  • The table view controller on top of that.

  • Another SWReveal view controller on top of that!

Instead of using a segue, just implement the didSelect... delegate method of the table view controller to call dismissViewController. Now the table view is removed in good order and you're back to the previous view controller.

Alternatively, set things up so that you can use an Unwind segue, which calls dismissViewController for you. That's different from a normal segue.

matt
  • 515,959
  • 87
  • 875
  • 1,141