ios - How to start a single timer and access it from multiple views? -


what recommended approach starting countdown nstimer on 1 view , having accessible stop interactively or have run out in another?

i know 1 option have nstimer never turn off once kicked off , use global variable determine whether countdown or not seems inefficient.

more details of i'm trying do:

in main view have label update count down 00:00:00 , button want open countdown uidatepicker.

the second view uidatepicker has start , stop button kick off or stop countdown.

this view close , label on original screen display countdown based on user selected previously.

it seems timer needed independent of views. can use singleton instance init once accessed anywhere. it's kind of global variable mention above if have more 2 views need access timer singleton might suitable choose


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -