objective c - Does NSTimer run across entire app? -


if start nstimer this:

@property (strong) nstimer * messagetimer;   self.messagetimer = [nstimer scheduledtimerwithtimeinterval:10.0                                      target:self                                    selector:@selector(checkformessages)                                    userinfo:nil                                     repeats:yes]; 

does continue run when switch different view controllers?

until cancel with:

[messagetimer invalidate]; self. messagetimer = nil;  

yes.

okay, here extended description. nstimer registers on nearest nsrunloop, is, current dispatch loop (they may nest). loop asks various sources events , calls corresponding callbacks.

when time nstimer fire, returns yes nsrunloop , runs passed callback. there no such thing "other current view controller". first responder , view hierarchy, neither doesn't have effect on run loops.


Comments

Popular posts from this blog

matlab - How to equate a structure array to structure array -

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -