cocoa touch - Core Animation performance on iphone -


I am trying to do some animation using the core animation on iPhone. I'm using CABasicAnimation on Caller. It is a straightforward future animation from the random space at the top of the screen which is at the lower speed of the screen, I have 30 elements which do the same action continuously until someone else The action should not happen. But when animation starts, the display on iPhone 3G is very sluggish. The image is only 8k.

Is this the right approach? How should I improve this so that it can perform better.

  // image cached somewhere else CGImageRef imageRef = [[UIImage imageWithContentsOfFile: [[NSBundle main bundle] pathForResource: name ofType: @ "png"]] CGImage]; - (zero) animate: (nstimer *) timer {int startX = round (radom)% 320); Speed ​​of float = 1 / goal (random ()% 100 + 2); CALayer * Layer = [Calair layer]; Layer.name = @ "Layer" layer; cittens = ifrafar; // cached image layer. Frames = cgartactmake (0, 0, cgmjetwidth (imagerof), cgimagegatehite (imager)); int width = layer.frame. Size.width; Int height = layer.frame.size.height; layer.frame = CGRactack (startx, self.viz.frame.org, width, height); [effect layer square: layer]; CGPoint start = CGTEXMake ( StartX, 0); CGPoint and = CGExMake (StartX, Self Vision.Fr. Float double digit = 1e100; CABasic animation * animation = [with CABasic animation animation: "position"]; animation.delegate = self; animation.frame value = [nsvl value withCGP: start]; animation. Towels = [NSVL value withCGP: end]; animation. Duration = speed; animation. RepeatCount = repeatCount; animation animation.removedOnCompletion = yes; animation.philmoda = kCFilModford; [add layer animation: animation fork: @ "status"];}  

NSTIMER Animation is removed using.

  Animeshntimr = [Anstimr timer Vithtaim Taim 0.2 target: self selector: @selector (animate :) userInfo: zero repeats: YES]; [[NSRunLoop currentRunLoop] addTimer: AnimationTimer Formoide: NSDefaultRane Loop MODE];  

OK, here are some things:

Why do you have an animation Are you using an NSTimer to put the fire on again? Just repeat the animation if they need to break and resynchronize, then you can do it with an animation.

  CGI image RIF imageRF = [[URL = UIImage imageWithContentsOfFile: [[NSBundle main bundle] pathForResource: name ofType: @ "png"] CGImage];  

Every one for every 30 seconds on a timer in 0.2 seconds? Have you certified your app? What percentage of time does it cost in image decoding? If you switch to using the image: Name: iOS OS will cache images, as long as there is enough RAM, which reduces your decode time:

  CGMage image = [[UIImage imageNamed: [NSString stringWithFormat: @ "% @. PNG", name]] CGImage];  

Also, do your images have transparency, which should be alpha composite? If you can avoid alpha then this is a big speed win over older iPhones.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -