5

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];
}
Neil Sardesai
  • 147
  • 1
  • 8
  • mate, show the declaration of the progressView and the entire section where you set it – Woodstock Jun 14 '15 at 20:47
  • Created a new project just to be certain that it's not something else in my code messing with the progress bar. This project literally has nothing more than a progress view in an empty view controller. Still the same issue. – Neil Sardesai Jun 14 '15 at 20:58
  • and it's still happening? – Woodstock Jun 14 '15 at 20:59
  • I made a new project, added a progressView in the storyboard, set auto layout constraints to keep it centered. then set the progress like this : [self.progressBar setProgress:0.5 animated:NO]; no issues whatsoever, can you post your project and i'll check it (the new sample one) – Woodstock Jun 14 '15 at 21:00
  • https://www.dropbox.com/s/2gtc4lp9kd6b15w/ProgressViewTest.zip?dl=0 Here's a link to the new project. Using Xcode 7. – Neil Sardesai Jun 14 '15 at 21:04
  • Interestingly, if I set "animated:" to "YES", the progress view does this weird glitchy animation where the size and position of the view changes. – Neil Sardesai Jun 14 '15 at 21:09
  • I'm grabbing Xcode 7 now (beta build 7A120f) to take a look, its really weird, code looks fine! Might be a beta bug, however I'll take a proper look when I have the Xcode beta in a few mins – Woodstock Jun 14 '15 at 21:09
  • Took a quick screen recording of how it looks when "animated:" is "YES" https://www.dropbox.com/s/6xn16tvttlp8wtu/progressViewAnimatedYES.mov?dl=0 As you can see, the progress view's size and position somehow got animated (all while the progress wasn't set to what I specified). – Neil Sardesai Jun 14 '15 at 21:14
  • really interesting... I ran this code in Xcode 6 (had to change deployment target to 8.3 but that was it) and it works perfectly: http://i.imgur.com/u6HaYaO.png .... must be an issue with the beta! – Woodstock Jun 14 '15 at 21:18
  • Wow. That's weird. Guess I'll go report the bug to Apple. – Neil Sardesai Jun 14 '15 at 21:20
  • Yup, good man. When I get the Xcode 7 beta I'll run the test again and let you know. – Woodstock Jun 14 '15 at 21:21
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/80533/discussion-between-woodstock-and-neil-sardesai). – Woodstock Jun 14 '15 at 21:23

1 Answers1

5

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.

Woodstock
  • 22,184
  • 15
  • 80
  • 118