Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow circularSpinner #3

Open
ghost opened this issue Jan 24, 2014 · 2 comments
Open

Slow circularSpinner #3

ghost opened this issue Jan 24, 2014 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 24, 2014

Hi, i see something: When i start circular spinner in Simulator, the speed is more fast (because of memory or cpu is faster then device). When i start it in iPhone 4 or 3gs, the circular spinner is very very slow. Can you explain why and how i can perform it? Did you use shadow in circular spinner?

Thanks.

@astrokin
Copy link

I fixed this bug.
All you need is replace timerFired method implementation with next:
- (void) timerFired:(NSTimer *)timer // for TJCircularSpinner calls { _angle = _angle+_rotationAngle; if (_angle>360) { _angle = 00.00; } NSNumber *rotationAtStart = [self.layer valueForKeyPath:@"transform.rotation"]; CATransform3D myRotationTransform = CATransform3DRotate(self.layer.transform, M_1_PI, 0.0, 0.0, 1.0); self.layer.transform = myRotationTransform; CABasicAnimation *myAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; myAnimation.duration = 0.1; myAnimation.fromValue = rotationAtStart; myAnimation.toValue = [NSNumber numberWithFloat:([rotationAtStart floatValue] + M_1_PI)]; [self.layer addAnimation:myAnimation forKey:@"transform.rotation"]; }
The main performance issue for all code is redrawing UI elements. There is no need to do it. All you need is draw UI once time and just transforming it in future.

@run4jit
Copy link
Contributor

run4jit commented Feb 24, 2014

I will check performance on iPhone 4 and 3GS devices and update the fix.
Thanks for using and giving your valuable input to improve this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants