可以滚动的button iOSiPhone/iPad

动画 (276)

可以滚动的button
3我也要赞一下
  • 访问次数:39
  • 下载次数:0

最后更新时间:2015-09-26

压缩包预估大小:未知

下载源码 收藏

GITHUB REPO



-(void)start{
    [self.layer removeAllAnimations];
    // Set the index to 0 on starting
    currentIndex = 0;
    _isRuned = YES;
    // Set running
    _running = YES;
    
    //Start the animation
    [self animateCurrentTickerString];
}
-(void)pause{
    // Check if running
    if (_running) {
        // Pause the layer
        [self pauseLayer:self.layer];
        
        _running = NO;
    }
}

-(void)resume{
    // Check not running
    if (!_running) {
        //Resume the layer
        [self resumeLayer:self.layer];
        
        _running = YES;
    }
}

#pragma  mark -UIView layer animaion utiltiles
-(void)pauseLayer:(CALayer *)layer{
    CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil];
    layer.speed = 0.0;
    layer.timeOffset = pausedTime;
}
-(void)resumeLayer:(CALayer *)layer{
    CFTimeInterval pausedTime = [layer timeOffset];
    layer.speed = 1.0;
    layer.timeOffset = 0.0;
    layer.beginTime = 0.0;
    CFTimeInterval timeSincePause = [layer convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime;
    layer.beginTime = timeSincePause;
}






相关源码

关于我们 新手指南