• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTimer and touch events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSTimer and touch events
      • From: Ben Kennedy <email@hidden>
  • Prev by Date: Re: checking if directory is writable
  • Next by Date: Re: NSTimer and touch events
  • Previous by thread: Re: checking if directory is writable
  • Next by thread: Re: NSTimer and touch events
  • Index(es):
    • Date
    • Thread