The timer never invokes the method. What am I doing wrong ? This is the code:
NSTimer *manualOverlayTimer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(hideManual) userInfo:nil repeats:NO];
method:
-(void)hideManual
thanks
in your code fragments it does not show when and where the
NSTimer
is fired.if you want to use the
NSTimer
, you should fire the timer after the init, like this:but you can use the following line in your any method as well:
it looks easier in this case than working with
NSTimer
.It was a thread issue. I've fixed with:
You don't need an NSTimer for a task of this sort. To hide your view object after a specific period of time on main thread you can use a gcd method dispatch_after
where 2.0 is an amount of seconds that will pass before the block will get executed
Just use this
EDIT
This code work well when
btn
(anUIButton
) pressed and-(void)btnPressed
function called.try this :