Look at - (void)viewWillDisappear:
Timer from previous push of view controller is still running
-
12-10-2022 - |
Question
I have a navigation controller which I push a further view controller into when needed. This pushed view controller has a function fired off every minute using performSelector:withObject:afterDelay.
All this works fine but I've noticed that the function is still firing off long after having tapped < Back out of the pushed view controller.
I can see why this is happening- I'm not telling the pushed view controller to cancelPreviousPerformRequestsWithTarget upon exit. But since viewDidUnload is no longer supported and dealloc similarly doesn't seem to be called when tapping < Back, can anyone suggest the best way to go about performing this at the correct time?
La solution
Autres conseils
You have at least two entry points:
viewWillDisappear:
, invoked when the view is about to disappearviewDidDisappear:
, invoked when the view has disappeared