سؤال

I seem to have the opposite problem to most people. I'm calling setProgress on my UIProgressView (which is added to my cell view). I'm calling it with NO animation but the change seems to be animated and I can't seem to switch it off.

What I see is the bar 'slides' from the current level to the requested level instead of jumping straight there. I assume that this is what is meant by an animation?

I'm using xcode 5.0 and simulating for the 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]];

...and later

[self.progressPlay setProgress:progress / duration animated:NO];
هل كانت مفيدة؟

المحلول

This appears to be either a bug or a "feature" of the UIProgressView when you use the UIProgressViewStyleBar style. If you initialize the progress view with UIProgressViewStyleDefault, it will not ignore the animated:NO option.

You can get a similar style to the "Bar" style by setting both the trackImage and progressImage properties of the UIProgressView to a solid color image of the right size.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top