I have an iOS 7 app with a side hamburger menu and a main table view controller where I display content. Whenever the user selects an item in my side menu, I'm hiding the side menu and I want to reload data in the main view controller. My initial thought was to put my data refreshing code in my main view controller's viewWillAppear
:
But when I set a breakpoint in viewWillAppear:
, I get 2 calls when the view controller initially appears, one from UIViewController
itself, and another from [ECSlidingViewController viewWillAppear:]
where the following line seems to call my viewWillAppear:
again
[self.topViewController beginAppearanceTransition:YES animated:animated];
On the other hand, when I show the left menu and then hide it, my view controller's viewWillAppear:
is not called this time, so data is not refreshed in my case.
Did I miss something in my configuration somewhere? Is that a bug or a feature? How should I use it?
PS: I used to use IIViewDeckController
and I had the exact same problem, so I switched to ECSlidingViewController
because it said that "Your view controllers will receive the appropriate view life cycle and rotation methods at the right time.".