0

I have a while loop and whenever i do

while (b == 0) {

[progressView setProgress: [progressView progress] +0.01]}

The progress never changes. Any help?

XtremeHek3r
  • 381
  • 2
  • 16

1 Answers1

0

Because your while loop never releases the main thread to actually render the change to the progress view.

You should generally have a thread running in the background doing something and passing callbacks to the main thread with a progress value that is then used to update the UI.

Wain
  • 118,658
  • 15
  • 128
  • 151
  • What exactly? You need to be more specific. Have you used GCD before? Do you understand what threads are? – Wain Feb 21 '15 at 21:01
  • @XtremeHek3r Although this answer is partially correct, even if the UI were updating on the main thread within the loop, the loop would take milliseconds to complete anyway and you wouldn't actually be able to see the progressive changes. How much time do you want between progress updates? – Lyndsey Scott Feb 21 '15 at 21:23
  • And how are you currently trying to achieve that delay? Is this real code you're showing or a test? – Wain Feb 22 '15 at 09:20