I have the following two statements which in essence should do exactly the same thing as far as I understand:
//[NSTimer timerWithTimeInterval:2.0 target:self selector:@selector(hideSuccessImageFromAllScreen:) userInfo:nil repeats:NO];
[self performSelector:@selector(hideSuccessImageFromAllScreen:) withObject:nil afterDelay:2.0];
followed by
-(void)hideSuccessImageFromAllScreen:(NSTimer *)timer{...
The perform selector method runs just fine and the selector is executed. However, if I uncomment the first line and comment out the second one the selector never fires. What am I doing wrong? Do I have to start the timer manually?
Thanks!
You either have to start the timer manually, or use
+[NSTimer scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:], which will automatically start it for you: