swift2 - Invalidate NSTimer when going back navigation not forward -
i have nstimer counts down number of seconds. timer sits in middle view of 3 view process.
i need invalidate timer because have found if don't app memory starts blowing out (strong reference).
i put invalidate in viewwilldisappear method because there 1 more view user can segue stops timer , when user comes view countdown paused.
how can invalidate nstimer if user goes in view hierarchy , not forward.
you can in viewwilldisappear
:
if(![self.navigationcontroller.viewcontrollers containsobject:self]) { [timer invalidate]; }
Comments
Post a Comment