ios 圆UICircularSlider UIView+Animation 几个简单的动画

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{

    

    NSLog(@"____%@",change);

    

    [selfanimationForNumber:[[change valueForKey:@"old"] intValue] newValue:[[change valueForKey:@"new"] intValue]];

}

 

- (void)animationForNumber:(int)oldValue newValue:(int)newValue{

    

    int oldNum2 = (oldValue / 10) % 10;

    int newNum1 = newValue % 10;

    int newNum2 = (newValue / 10) % 10;

    

    if (newValue > oldValue || newValue < oldValue) {

        NSString *direction = newValue > oldValue ? kCATransitionFromTop : kCATransitionFromBottom;

        self.labelSecondNumber.text = [NSString stringWithFormat:@"%d",newNum1];

        [UIViewanimationPush:self.labelSecondNumberdirection:direction duration:0.0];

        if (oldNum2 != newNum2) {

            self.labelFirstNumber.text = [NSString stringWithFormat:@"%d",newNum2];

            [UIView animationPush:self.labelFirstNumber direction:direction duration:0.0];

//            [UIView animationFlip:self.labelFirstNumber direction:direction]; //这里是不同的动画效果。

        }

    }

}

 

 

 

- (void)viewDidLoad

{

    [superviewDidLoad];

    

    self.view.backgroundColor = [UIColorcolorWithRed:38.0/255.0green:38.0/255.0blue:40.0/255.0alpha:1];

    self.date.textColor = [UIColorcolorWithRed:92.0/255.0green:98.0/255.0blue:101.0/255.0alpha:1];

[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(countDown:) name:@"countDown"object:nil];

    

    [self.circularSlideraddTarget:selfaction:@selector(updateProgress:) forControlEvents:UIControlEventValueChanged];

[self.circularSlidersetMinimumValue:0];

[self.circularSlidersetMaximumValue:360];

    if (mIsiP5) {

        self.statusView.frame = (CGRect){120,170,80,18};

    }

}

    

- (IBAction)updateProgress:(UISlider *)sender {

 

    int value = (75 * (sender.value/360));

    

    NSLog(@"_______%d",value);

    

[self.circularSlider setValue:sender.value];

    

    [self.numberView setValue:value];

    

}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值