I have never encountered this situation on an iPhone, but on a Mac I had a similar problem.
- Use CGLayer to delegate drawing activity to autonomous contexts.
- Try to add a timer for the current NSRunLoop and execute graphical commands for the time interval. It should look something like this ...
...
kRenderFPS 25.0 //This is Maximum value renderTimer = [[NSTimer timerWithTimeInterval:(1.0 / (NSTimeInterval)kRenderFPS) target:viewobject selector:@selector(RenderUI:) userInfo:nil repeats:YES] retain]; [[NSRunLoop currentRunLoop] addTimer:renderTimer forMode:NSDefaultRunLoopMode]; [[NSRunLoop currentRunLoop] addTimer:renderTimer forMode:NSModalPanelRunLoopMode]; [[NSRunLoop currentRunLoop] addTimer:renderTimer forMode:NSEventTrackingRunLoopMode]; //In view class -(void)RenderUI:(id)param { [self setNeedsDisplayInRect:[self bounds]]; }
That should do the trick.
Also try trying your process and see who consumes the processor. This will make the UI responsive and very fast.
The performance issue you were talking about might be caused by something else. Try to process the processor sample. This will give you an idea of who actually takes the processor.
source share