nstimer

nstimer and new iOS4, confused :(

Hi I'm very concerned about multitasking, being the lazy developer who is not very happy to update apps. Let's say I have a NSTimer, which, after a play button is pressed, every second calls a method, which changes the label of minutes and seconds of an audio file (which obviously is playing after the play button is pressed). Until th...

Adding breakpoint in gdb using fb -[NSTimer release] doesn't work. How can I add a breakpoint on [NSTimer release]?

Hi I have seen a few examples of adding breakpoints in gdb using the command fb. I have tried using the following but it doesn't work... fb -[NSTimer release] I tried it but it says. Function "-[NSTimer release]" not defined. As you can probably tell I want the debugger to stop when release is called on any NSTimer object. How c...

Displaying stop watch

Hi All, In my app I want to display stop watch kind of thing i.e when the user starts the app a atop watch should start and stops when the user presses the stop button. I am not sure as to how to use the NSTimer in this case. ...

NSTimer and updating UI

Hi all, Ive been trying to get my game to work correctly with an NSTimer. Ive seen many people have had a similar problem to me and I just need a bit of clarification on something. Basically I have an NSTimer running on the main thread which is updating images which represent the time, but I also have a mapView. When the user pans the ...

Threaded NSTimer

Hi all, I am aware of the many questions regarding this topic, as I myself have asked one previously however, my issue now seems to be more related to the threading part. I have the following 2 methods. -(void) restartTimer { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; self.timer = [NSTimer scheduledTimerWithTimeInterval...

How to properly invalidate an NSTimer

I've got an iPhone app with an NSTimer called pressTimer that goes off every time someone touches this button. The problem is they touch the button a lot, and I want the timer to stop when they lift up their finger. So I declared pressTimer in my .h and synthesized it in .m then assigned and started it on the TouchDown action I created. ...

Timer causing app to freeze in some situations

Here is the code: - (IBAction) startRecognition:(id)sender { backgroundSoundLevel = [backgroundSoundChange stringValue]; timer = [NSTimer scheduledTimerWithTimeInterval:0.25 target:self selector:@selector(timerFired:) userInfo:nil repeats:YES]; } - (void)timerFired:(NSTimer*)theTimer { NSString *charlieSoundVolume = [cha...

Objective c time delay

Here is my code so far: - (IBAction) startApproximiteLevel:(id)sender { [getBackgroundLevel startAnimation:self]; float sample1; float sample2; float sample3; float sample4; float sample5; float finalSample; float charlieSoundVolume = [charlieSoundLevel floatValue]; sample1 = charlieSoundVolume; sleep(1) sample2 = charlieSoundVolume; ...

Confused about NSCFTimer... what is it?

Could someone tell me what exactly NSCFTimer is? I get it when I ask NSTimer for a timer. My problem is that I'm trying to check if an object (supposedly an NSTimer, note the word "supposedly" which is why I'm checking) is an object of class NSTimer, it doesn't seem to work. Does this "NSCFTimer" in any way... hinder the process? ...

Best method to get text to blink in iPhone OS?

I want my text box to blink (like the old LCD clocks) and right now I'm calling a myriad of NSTimers and selectors that wait, change the alpha, wait, then change it back. Even with this it looks really bad, and I'm thinking I have to put an NSTimer to gradually change the alpha, but from what I hear they are not meant for things of that ...

Performance issue with DrawRect and NSTimer

I'm trying to make a slot machine animation where the reels spin. to do this, I'm using drawRect to draw images in a custom class that inherits from UIView. I'm using an nstimer to update the position of the images and calling [self setNeedsDisplay] to update the drawing. In the simulator, it looks very good, however, on the device, it i...

NSTimer allocation as a property

If I wanted to create a simple class that has three instance variables and methods like NSInteger seconds; NSInteger minutes; NSTimer *timer; - (void)setMinutes:(NSInteger)m; - (void)setSeconds:(NSInteger)s; - (NSInteger)minutes; - (NSInteger)seconds; What I want is to initialize a NSTimer object and have it countdown wi...

NSTimer is not working fine ..in Animation in iPhone

Hi...im new to iPhone programming..in my app the timer is not working fine. can anybody help me out please... The following is the code for animating few images wn we touch or swipe..they fall down i want to restrict the touches for few seconds with use of timer... is there another way to do this..?(before using timer its crashing on d...

whats the proper way of passing an argument to NSTimer

Im using a basic timer that calls a method which is defined as below: - (void) refresh:(id)obj { if (obj == YES) doSomething; } I want to call this method from certain areas of my code and also from a timer [NSTimer scheduledTimerWithTimeInterval:refreshInterval target:self ...

iPhone- Dynamically update NSDate for clock?

I've made a clock, and I'm trying to update it so it displays, well, the time. When I initiate the NSDate it is an instance of the exact current time, for the time it was initiated. So what I have going on here is pinging the updateTime function with an NSTimer to update the clock every 3 seconds. It seems that there should be a way to ...

Having issues with iPhone NSTimer invalidation.

Okay so I know I asked a similar question a while ago, but this is different. I now have two timers that go off on the TouchDown event of their respective buttons. On the TouchUpInside event I have respective code that tells each timer to [pressTimer invalidate] and pressTimer = nil. The problem that happens now since I added the second ...

NSTimer doesn't work without UIApplication?

I have a custom iPhone application which doesn't rely on UIKit in any way (it is not linked to UIKit). This means that I'm not using UIApplication and therefore not calling UIApplicationMain. The problem is that when I create a timer it never fires. The timer is created like that: [NSTimer timerWithTimeInterval:10 target:self selector:...

NSTimer where code repeats every (some time value in seconds) for 1 minute.

I have read some docs on NSTimer and havent quite seen what I am looking for. I would like to know how to write an NSTimer which will repeat every 1 sec or another time value(maybe have this value as parameter) and the overall repeat should repeat for one minute. Also how is this overall time (1 minute) shown on screen , maybe in a UI...

How to nest a NSTimer within another one?

I would like to have an NSTimer which executes every 1 second and have another NSTimer which executes within that timer slightly less than 1 second. Actually I am not sure what is the best way to do this, but I would like a random image to appear every second and then disappear after after that second. So I need some kind of stall or...

probelem with NSTimer

Hi I have a problem with a NSTimer I recived a "SIGABRT" error and "[NSCFTimer intValue]: unrecognized selector sent to instance " These is my code: -(void)detectionMove:(NSNumber*)arrayIndex{ static BOOL notFind = FALSE; static int countVariable = 0; static int countRilevamenti = 0; notFind = FALSE; for(int i =...