NSTimer and touch events
NSTimer and touch events
- Subject: NSTimer and touch events
- From: "Eric E. Dolecki" <email@hidden>
- Date: Tue, 10 Jan 2012 15:03:27 -0500
This is odd. Perhaps I need coffee. I have an app where I hide something by
default (UIView). touchesBegan will make it visible. touchesMoved keeps
visible. touchesEnded after 2 seconds. My method is never getting called.
In my .h
NSTimer *screenTimer;
...
@property(nonatomic,retain) NSTimer *screenTimer;
My .h
----------------------------------------------------------------------
@synthesize screenTimer;
...
//Never called...
- (void)turnOffScreen:(NSTimer *)theTimer {
NSLog(@"TURN OFF SCREEN");
myView.hidden = YES;
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
myUIView.hidden = NO;
if(screenTimer.isValid){
[screenTimer invalidate];
}
}
//After 2 seconds hide the view
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
screenTimer = [NSTimer timerWithTimeInterval:2 target:self selector:
@selector(turnOffScreen:) userInfo:nil repeats:NO];
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden