ios - How to toggle the visibility of buttons with a timer? -
Ive added an NSTimer that shows my rate button by setting a hidden action
NSMethodSignature * sgn = [Self-method sign-in selector: @Selector (Ontik :)); NSIVWocation * INV = [NSINVON orientation orientation method: sign: sgn]; [Inv setTarget: self]; [Inv setSelector: @selector (onTick :)); NSTimer * t = [NSTimer timer-defined time interval: 10.0 orientation: inv repeats: yes]; NSRunLoop * Runner = [NSRunLoop currentRunLoop]; [Runner addTimer: T-Fold mode: NSDFastRarLopPoids];
then
- tick on (zero): (NSTimer *) timer {_Rateapp1.hidden = NO; _ratebomb.hidden = NO; _ratelab1.hidden = NO; }
But how can I reveal the button again with yes?
Below your goal that toggle the display of the button every time the timer is off, just you Do this:
- Tick on (zero): (nstimer *) timer {_Rateapp1} = hidden! _Rateapp1.hidden; _ratebomb.hidden =! _ratebomb.hidden; _ratelab1.hidden =! _ratelab1.hidden; }
And you can change all your timer creation codes in the following way:
NSTimer * t = [NSTimer Scheduled timer with time interval: target 10.0 : Self Selector: @Selector (OnTick :) userInfo: Zero repeats: Yes];
There is no need to invite or runlop code. I also suggest that you stay in the context of the timer so that you can cancel the timer if necessary.
Comments
Post a Comment