【发布时间】:2014-08-01 12:26:23
【问题描述】:
我正在尝试使用以下代码增加百分比视图:
// Progress
[UIView animateWithDuration:5.0 animations:^{
for (float percent = 0.0; percent <= 0.86; percent+=0.01) {
NSLog(@"%f", percent);
self.circularProgress2.progress = percent;
}
}];
它没有动画,它直接进入最终值。我知道我可以使用NSTimer:
[NSTimer scheduledTimerWithTimeInterval:0.0001 target:self selector:@selector(onLableAnimateTick:) userInfo:nil repeats:YES];
然后从被调用方法内部更改值。但是我在同一个视图上有几个条,所以我想使用第一个选项对我来说会更好。
如果不可能,我将如何复制 NSTimer 行为而不必为每个进度条创建 properties 和方法?
【问题讨论】:
标签: ios objective-c for-loop uiview nstimer