I’ve set up a really simple project using storyboards including two views as shown here: https://i.stack.imgur.com/iRx21.png. The navigation can be done by either selecting a cell in the custom table view or hitting the back button labelled with “<<“. Everything works fine except the following:
when I switch between the views, every time an instantiation happens. The profiling shows an increasing number of view objects. I would like to keep only one of each view and instantiation should be happen only once. What am I doing wrong? (I’m using ARC.)
Thanks in advance!
You should not link your back button to the parent view controller. This is what causes the new instantiation.
The way to go is to embed the table view into
UINavigationController(in IB, chooseEditor -> Imbed In -> Navigation Controller. Then change your segue to aPushsegue. You can of course hide the navigation bar etc. to make things look exactly as you like. Then, link the back button to the controller with anIBActionand in the handler do a simpleThis would be the appropriate logic of what you are doing. Of course, you can also push the web view modally and then handle the button click with