nstimer

iPhone OpenGL and NSTimer issues

I have an NSTimer that runs at 60hz. With an OpenGL scene loaded and rendering, my game can get 60fps, solid, all day long.. Then if I go and recompile the app, or reload it, it will get 40fps. Same resources loaded. I've been running into this problem for years, and I just want to know why. It's crazy, and I want to know if I should...

iphone NStimer start in 2 seconds

I am trying to have a block of code run 2 seconds after I 'start' it. I think the NSTimer can do this but can't figure it out. ...

iPhone NSTimer OpenGL problem

I've got a problem that only seems to occur on the device, not in the simulator. My app's animation is started and stopped using these methods: NSTimer* animationTimer; -(void)startAnimation { if(animationTimer == nil) animationTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f/60.0f target:self selector:@selector(drawVi...

How can I break from a method prematurely that's being called by NSTimer

Basically I'm writing a metronome app, but I'm using a sound file that, depending on the BPM, might not be finished playing when the "play" method is called again. For example, if the sound file is 0.5 seconds long, but the BPM is 200, the "play" method needs to be called every 0.3 seconds. I'm not overly familiar with NSTimer, but it a...

How do you send a key command using an NSTimer to a hidden application?

I am trying to write an app for Toontown that will send the "end" key when the application is minimized or hidden. How do I do this. I cant figure it out Thanks ...

"Multi-threading" w/ NSTimers in an iPhone app

Say I have two NSTimers in my iPhone app: timer1 and timer2. timer1 calls function1 30 times per second and timer2 calls function2 30 times per second. Assume these two functions are reading and updating the same integer variables. Are there any "multi-threading" issues here? If not how does iPhone OS handle the execution of the two...

Displaying timecode using NSTimer and NSDateFormatter

Hi. I am very close to completing my first iphone app and it has been a joy. I am trying to add running timecode using the current time via an NSTimer displaying the current time (NSDate) on a UILabel. NSDate is working fine for me, showing hour, minute, second, milliseconds. But instead of milliseconds, I need to show 24 frames per ...

Is there a way to write a NSTimer so it just pauses the program for a second?

Trying to change a button pic, wait a second, then change back. Not having much luck trying to get that to work, so is there a way to just pause the program for a second, without having a timer actually executing anything, and without the program going on with the code? ...

Add a stopwatch like label

Hi there, I'm searching a way to display the time elapsing during the reflexion of the application user. example : UILabel displaying 0:01, 0:02, 0:03 etc until the user click on a button. I guess NSTimer should be used, but could anybody provide me some example code to implement that simple label ...? Cheeerio and many thanks ... ...

Why am I getting a EXC_BAD_ACCESS in a NSTimer selector?

I've got quite a weird problem. To make it short, i'll write some pseudo-code: init: create a dictionary and insert n elements. create a "repeat timer" and add it to the currentRunLoop using the timerRefresh selector. timerRefresh: using a list of keys, find the items in the dictionary if the item exists -> call a f...

NSTimer timestamp timeinterval question

I have the following code: [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timerCount:) userInfo:nil repeats:YES]; -(void)timerCount:(NSTimer *)timer { NSTimeInterval dt = [timer timeInterval]; // do something } The NSTimeInterval I got will be 0.5, the time interval I've put on scheduledTimerWithI...

NSTimer calculate hours

I am using an NSTimer which I have working to show minutes and seconds. But I am confused about the math needed to calculate hours. I am using: - (void)updateCounter:(NSTimer *)theTimer { static int count = 0; count += 1; int seconds = count % 60; int minutes = (count - seconds) / 60; // Not sure how to calculate h...

NSTimer Reset Not Working

hi, i have a nstimer and it works perfectly counting down from 2:00 but when i hit the reset button it does not work it just stops the timer and when i press start again it will carry on with the timer as if it had never been stopped. Here is my code `@implementation TimerAppDelegate @synthesize window; (void)applicationDidFinishLaunc...

NSTimer as a timeout mechanism

I'm pretty sure this is really simple, and I'm just missing something obvious. I have an app that needs to download data from a web service for display in a UITableView, and I want to display a UIAlertView if the operation takes more than X seconds to complete. So this is what I've got (simplified for brevity): MyViewController.h @inte...

How to make UIButton work like Launcher in SpringBoard, when pressed for long timeinterval

In my ViewController I am using UIButton which triggers some action when touchedUpInside. Upto here no problem, but i also want to add another action for touchDown event. More precisely i dont have an idea how to add that action to which event, that will work the same as when App-Icon is pressed longer in springboard which causes springb...

How to know a movieplayer release finished?

I aims to release a movieplayer (theMovie) and then start another action (so-called playButtonClicked) after it is completely released. I used performSelector to delay the "playButtonClicked" for 1 second and it works well. The code is: [theMovie release]; [self performSelector:@selector(playButtonClicked) withObject:nil afterDelay:1];...

NSTimer Lag - iPhone SDK

Hello everyone, I made a game that uses many timers throughout the code. However the timer has to deal with many tasks in such a small amount of time which leads to the problem where there is lag in my game. For example, my timer runs at an interval of (0.05) and it needs to draw and update many of the images on the screen. Is there any...

Running and managing NSTimer in different NSThread/NSRunLoop

I'm writing a Cocoa application, with a GUI designed in Interface Builder. I need to schedule background activity (at regular intervals) without blocking the UI, so I run it in a separate thread, like this: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { [self performSelectorInBackground:@selector(schedule) w...

how to use nstimer

i think nstimer will use for scrolling text automaticallr ... can any body tell how to use that for this purpose.. ...

Optimising simple animations with only a few frames

Hi there everyone. I've managed to set up a button which when pressed displays a thought bubble. The bubble appears first as a smaller bubble, then a slightly larger bubble, then finally the full sized bubble, all in quick succession. I've managed to do this just fine with the following code, I'm just wondering if this really is the best...