UISlider不在iOS7中动画 [英] UISlider not animating in iOS7

查看:209
本文介绍了UISlider不在iOS7中动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从iOS 6切换到iOS 7设计时,我注意到使用方法 setValue:animated:不再动画滑动过程。有没有其他人遇到这个问题,并找到一个解决方案?

When I switched from iOS 6 to iOS 7 design, I noticed that using the method setValue:animated: no longer animates the sliding process. Has anyone else came across this problem and found a solution?

我只是添加一些代码来显示我没有做任何复杂的:

I'll just add some code to show I've done nothing complicated:

//Variable declaration
IBOutlet UISlider *s; //Connected in the .xib

//Button pressed
- (IBAction)buttonPressed:(id)sender
{
    [s setValue:1 animated:YES];
}

按下按钮后直接跳到1。

And it jumps straight to 1 after I press the button.

推荐答案

向后兼容iOS 4解决方案/解决方法:

Backwards compatible to iOS 4 solution/workaround:

[UIView animateWithDuration:1.0 animations:^{
    [_sliderTest setValue:0.90 animated:YES];
}];

看来iOS 7不会动画,除非你同时指定这个块和动画:YES。 iOS 6.0似乎忽略动画块并执行自己的内部块。金达奇。指定持续时间为2.0,以使iOS 7动画的速度比iOS 6的速度慢两倍,代码相同。

It seems that iOS 7 wont animate unless you specify both this block and animated:YES. iOS 6.0 seems to ignore the animation block and execute its own internal block. Kinda odd. Specify a duration of 2.0 to see iOS 7 animate twice as slow as iOS 6 with the same code.

这篇关于UISlider不在iOS7中动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆