UILabel animation oben und unten

Habe ich diese UILabel animation, animiert, einen countdown-timer. Es funktioniert gut, aber...

Jetzt, es ist so eingerichtet, dass der text vereinfacht aus der Spitze mit der CATransition kCATransitionFromBottom. Dies dauert 0,5 Sekunden. Wie kann ich es so machen, dass in den nächsten 0,5 Sekunden, die CATransition und mein label erleichtert von unten?

Hoffe, Sie verstehen! Danke!

Hier ist ein video wie die animation aussieht im Moment: http://tinypic.com/r/5vst2h/8

-(void)updateLabel {

NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
int *units = NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
NSDateComponents *components = [calendar components:units fromDate:[NSDate date] toDate:destinationDate options:0];


    //ANIMASJON

secLabel.alpha = 0;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];

//don't forget to add delegate.....
[UIView setAnimationDelegate:self];

[UIView setAnimationDuration:0.5];
secLabel.alpha = 1;

//also call this before commit animations......
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];

CATransition *animation = [CATransition animation];
animation.duration = 0.5;   //You can change this to any other duration
animation.type = kCATransitionMoveIn;     //I would assume this is what you want because you want to "animate up or down"
animation.subtype = kCATransitionFromBottom; //You can change this to kCATransitionFromBottom, kCATransitionFromLeft, or kCATransitionFromRight
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[secLabel.layer addAnimation:animation forKey:@"secLabel"];


[dayLabel setText:[NSString stringWithFormat:@"%02d%", [components day]]];
[hourLabel setText:[NSString stringWithFormat:@"%02d%", [components hour]]];
[minLabel setText:[NSString stringWithFormat:@"%02d%", [components minute]]];
[secLabel setText:[NSString stringWithFormat:@"%02d%", [components second]]];

[UIView commitAnimations];

}

-(void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished    context:(void *)context {
{
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.5];
    secLabel.alpha = 0;
    [UIView commitAnimations];
}
}
InformationsquelleAutor Fredrik | 2014-02-18
Schreibe einen Kommentar