ios - viewDidDisappear not called -


i work on application, have problem view[will/did]disappear methods not being fired when returning app.

the case is, have uinavigationcontroller, has 2 view controllers pushed on it. when user presses home button, user logged out. when later returns app, following (simplified) code run in appdelegate:

- (void)applicationdidbecomeactive:(uiapplication *)application {     [(uinavigationcontroller *)self.window.rootviewcontroller poptorootviewcontrolleranimated:no];     [self.window.rootviewcontroller presentmodalviewcontroller:loginviewcontroller animated:no]; } 

when pop off view controllers on navigation controller stack, expect view[will|did]disappear methods called. however, not case, since (apparently) not on screen anymore when ios going fire these methods. seems modal view controller has taken over.

if not present modal view controller, view[will|did]disappear methods called expected.

my question is: if want view[will|did]disappear methods called, how can structure code? there better place present modal loginviewcontroller?

edit:

in order show problems more clearly, have created simple test project here: https://github.com/johanvase/modalviewcausemissingviewdisappearcalls. please try couple of times follow instructions in app, , see not "resources" released in viewwilldisappear method.

i asked apple technical support same question. concluded bug in ios, have filed bug report apple. same bug seems appear in ios 6 , in latest ios 7 (beta 5).

apple technical support suggested following:

as workaround, can move cleanup code separate method appdelegate invoke on navigation controller's top view controller, before pops entire navigation stack.

however, think exposes of details in view controller, chose implement using willmovetoparentviewcontroller: instead. method called when view controller removed parent, , is called properly.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -