Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIProgressView Keeps Resetting to 0.0

I've got a UIProgressView in my Storyboard hooked up to my code. I'm trying to set the progress to something non-zero.

Here's an example of my code that I've placed in viewDidLoad.

[self.progressBar setProgress:(float)someValueBetween0.1and1.0 animated:NO];

However, what's happening is that the progress bar will be at the value that I set, and then quickly animate down to 0.0. For instance, if I set progress to 0.5, the bar will be filled half way when the view loads and then animate down to 0.0.

I've tried using

self.progressBar.progress = (float)someValueBetween0.1and1.0;

That hasn't worked either.

I'm not modifying the progress bar's progress via code anywhere else. I've tried Googling, reading the UIProgressView Class Reference, and searching Stack Overflow without any success :/

Edit: Created a new project with nothing more than a UIProgressView just to be sure it's not something else in my code. Still not working.

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIProgressView *testProgressView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.testProgressView setProgress:1.0 animated:NO];
}
like image 614
Neil Sardesai Avatar asked Jun 14 '15 20:06

Neil Sardesai


1 Answers

This is a bug in Xcode Version 7.0 beta (7A120f).

I've confirmed it in both Objective C and Swift.

It only occurs in the beta version, the same source executes correctly in Xcode 6.

Very strange bug.

like image 100
Woodstock Avatar answered Sep 28 '22 05:09

Woodstock