I am loading a huge amount of data from an XML file. This data is "freezing" the application. I would like to display a progress bar in the time that the data is being loaded.
How would I know that much of the operation has been completed so that I can change the percentage shown of the progress bar? Thanks. [answered]
Edited: The main problem is that the application freezes during loading due to the large amount of data to be parsed. Some have suggested using a background thread to load and parse the data.. Is that viable?
Read the file into memory @ 4k at a time? Show the process of loaded bytes vs file size?
Additionally figure out total number of lines and what current line your parser is on.
Assuming you are using NSXMLParser
The "freezing" is coming from you doing the load/parsing on the main thread. If you can us GCD trying doing a dispatch_async ( ) and sending updates to your main thread on completion and to update progress.