使用NSNumber初始化CATransition持续时间

时间:2015-12-21 17:13:30

标签: ios nsnumber nstimeinterval catransition

我想用CATransition初始化NSNumber的持续时间,我该怎么做,因为animation.durationNSTimeInterval个对象?

- (void)startPopUpAnimation:(NSNumber *)numbers {

    CATransition *animation = [CATransition animation];
    animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    animation.type = kCATransitionFade;
    animation.duration = @"2.15";//[NSNumber numberWithDouble:[numbers doubleValue]];

}

1 个答案:

答案 0 :(得分:0)

这比我想象的要容易:

animation.durationtypedef double,所以我刚刚做了:animation.duration = [numbers doubleValue];