1

I am trying to implement UIProgressview in my application it works fine , until i navigate to another view. When i navigate to another view controller , the progressview gets reset and starts updating again.

Is this a intended behavior of uiprogressview when pushing a view-controller , is there a way to fix my issue.

Please let me know your thoughts and advices.

user198725878
  • 6,266
  • 18
  • 77
  • 135

2 Answers2

0

You need to save the progress in application delegate variable and you have to set progressView.progress = appdelegate.variable in viewWillAppear method because progress view will be initialized after you return to the view. so saving the progress in a static variable will be better chouce

Sumanth
  • 4,913
  • 1
  • 24
  • 39
  • cant we do the downloading in background? and update the uiprogressview? – user198725878 Jun 29 '12 at 13:01
  • You can use NSThread/ GCD Dispatch background process for doing your non UI process for updating the UI means (progress View) you need to implement in main thread for more details check this link here. http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Multithreading/Introduction/Introduction.html – Sumanth Jun 29 '12 at 13:15
0

in view will disappear you can set some user defaults and again when you pop out the view get the value and set the progress bar with it. Don't forget to reset the last value when your bar get the original value from poping.

B25Dec
  • 2,301
  • 5
  • 31
  • 54
  • cant we do the downloading in background? and update the uiprogressview? – user198725878 Jun 29 '12 at 13:00
  • Actually ios SDK support only these things as a multitasking 1 down vote accepted Since iOS 4.0 iPhone supports "multitasking" this means if you click the home button your app sleeps, this needs almost no battery or memory and if the iPhone run out of memory it will terminate sleeping applications. Every app supports this kind of multitasking exepted you don't allow it for your app. But there are also three real multitasking functions: VoIP GPS Music Those three functions you can really use for multitasking apps. But nothing more...Except them you cann't do in background. – B25Dec Jun 29 '12 at 13:05
  • And updating the progress Bar you need to keep observing some Variable in Background and when you come to alive in application just assign that value to progress bar's value it will show the updated one values over there. – B25Dec Jun 29 '12 at 13:06
  • i mean , my downloads are again getting started newly – user198725878 Jun 29 '12 at 13:08
  • the background i am mentioning here is, within the application.when one view is downloding and updating the progressview, the user can go and use other part of the same application right? – user198725878 Jun 29 '12 at 13:10
  • Yes you can use Thread for that try to look around thread run in background and call the UI accordingly and update the progressview – B25Dec Jun 29 '12 at 13:22
  • Use variable which will get change values from your thread and when any one will come to your downloading view from another view Assign the variable to progress bar value. It will be populated there then – B25Dec Jun 29 '12 at 13:24