This Preloader is a simple Objective-C project that displays a preloader using UIProgressView while the data is being loaded and displays the PDF file after data loading is complete. You can download the project
here.
The project only contains one UIViewController. I've written comments in the code too.
But I still would like to share a quick overview:
Quick Flow of PreloaderViewController.m (i recommend looking at the code while reading this so you can get the grasp ):
1. loadView method
a. sets PDF url string
b. initialize UIWebView. The PDF file gets displayed using the UIWebView
c. initialize the UIProgressView and UILabel (which is 0%)
d. start NSURLConnection which loads the file
2. didReceiveResponse method
a. When the NSURLConnection gets response, it will display the UIProgressView and UILabel.
b. initialize the totalfilesize variable
c. initialize the receivedData variable to 0
3. didReceiveData method
a. does the calculation everytime a data is received and increments the progress values
4. connectionDidFinishLoading method
a. displays the PDF file