2016-11-17 4 views
1

Ein Code-Schnipsel aus https://github.com/danielamitay/DACircularProgress/blob/master/DACircularProgress/DACircularProgressView.mWelche Bedeutung hat der Fortschrittsschlüsselpfad in CABasicAnimation?

CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"progress"]; 
animation.duration = duration; 
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 
animation.fillMode = kCAFillModeForwards; 
animation.fromValue = [NSNumber numberWithFloat:self.progress]; 
animation.toValue = [NSNumber numberWithFloat:pinnedProgress]; 
animation.beginTime = CACurrentMediaTime() + initialDelay; 
animation.delegate = self; 
[self.circularProgressLayer addAnimation:animation forKey:@"progress"]; 

Aber ich nicht progress im offical document finden konnte. Muss der Schlüsselpfad eine animierbare Eigenschaft sein? Was bedeutet die progress?

+0

Ich glaube, Sie könnten den Code falsch interpretiert haben. Der 'forKey: @" Fortschritt "' benennt die Animation. –

+0

Ich meine die 'progress' in' [CABasicAnimation animationWithKeyPath: @ "Fortschritt"]; ' – Jichao

+0

Ups! Mein falsches Lesen, nicht deins! War vor der Bearbeitung offline –

Antwort

2

Von this answer (die zufällig progress auch animiert):

Erstens brauchen wir eine neue Unterklasse von CALayer erstellen, die eine animierbaren Eigenschaft hat ‚Fortschritt‘ bezeichnet.

Ihr Snippet hat in der Tat eine Eigenschaft namens ‚Fortschritt‘

@property(nonatomic) CGFloat progress; 

Es scheint, die Animation, die Eigenschaft wird Animieren

Verwandte Themen