UIProgressView setProgress不会停止动画

对大多数人来说,我似乎有相反的问题.我正在我的UIProgressView上调用setProgress(它被添加到我的单元格视图中).我没有动画调用它,但改变似乎是动画的,我似乎无法关闭它.

我看到的是从当前水平到所需水平的“滑动”栏而不是直接跳到那里.我认为这是动画的意思吗?

我正在使用xcode 5.0并模拟iPhone iOS7.

self.progressPlay = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
[self.progressPlay setFrame:CGRectMake(56.0, 34.0, 225.0, 11.0)];
[self.progressPlay setProgress:0.0 animated:NO];
[self.progressPlay setProgressTintColor:[UIColor colorWithRed:0.431 green:0.753 blue:0.949 alpha:1.0]];

…然后

[self.progressPlay setProgress:progress / duration animated:NO];

最佳答案 当您使用UIProgressViewStyleBar样式时,这似乎是UIProgressView的错误或“功能”.如果使用UIProgressViewStyleDefault初始化进度视图,则不会忽略animated:NO选项.

通过将UIProgressView的trackImage和progressImage属性设置为正确大小的纯色图像,可以获得与“Bar”样式类似的样式.

点赞