how to show a loading bar or progress bar in iPhone application whiele fetching data


I have an iPad application when view is loaded, i am calling method after some time duration so i want to display a loading bar till method is called and data is loaded.

I am Using NSTimer to call a method in viewDidLoad

[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(loadNews) userInfo:nil repeats:NO];


Use Activity Indicator to show progress bar or loading view.... like below.... in viewdidload..

CGRect frame = CGRectMake(0.0, 0.0, 25.0, 25.0); self.activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:frame]; [self.activityIndicator sizeToFit]; self.activityIndicator.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin); [activityIndicator startAnimating]; UIBarButtonItem *loadingView = [[UIBarButtonItem alloc] initWithCustomView:self.activityIndicator]; loadingView.target = self; self.navigationItem.rightBarButtonItem = loadingView;


You can use a <a href="http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIProgressView_Class/Reference/Reference.html" rel="nofollow">UIProgressView</a> to display loading progress. The Mail app uses this when downloading messages. For indefinite time periods, use a <a href="http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIActivityIndicatorView_Class/Reference/UIActivityIndicatorView.html" rel="nofollow">UIActivityIndicatorView</a> instead.

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/5TUsW.jpg" data-original="https://i.stack.imgur.com/5TUsW.jpg" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

It's discussed in the <a href="https://developer.apple.com/library/safari/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html" rel="nofollow">iOS HIG.</a>


Rather Do

[NSThread detachNewThreadSelector:@selector(loadNews) toTarget:self withObject:nil];

Then stop the loadingview when you are finished using something like

[activityIndicator setHidden:YES];

Hope this helps you.


I like to use <a href="https://github.com/jdg/MBProgressHUD" rel="nofollow">MBProgressHUD</a>. It lets you easily customize your loading progression, with different states. Like initialization, downloading, cleaning...


  • Why is Volley's onResponse not called
  • memory leak using MBProgressHUD
  • Redis scan skipping keys
  • Chrome identity api to get profile info
  • Help with SimpleCursorAdapter and Listview
  • Stored data can't access in Yii
  • UIBarButtonItem - Argument of '#selector' cannot refer to local function - Swift 3
  • Expand header row into multiple child rows
  • updatesearchresultsforsearchcontroller not called
  • windowScriptObject method not found on Objective-C code
  • Printing input from TextField to a Label in Xcode with Swift
  • Best approach for UITableViewCell with both a left and right label
  • OSStatus error -50 (invalid parameters) AudioQueueNewInput recording audio on iOS
  • Why can't I extract data from media file using AVURLAsset in a Playground?
  • textIndicatorPrecision in dojox.dgauges using dojo
  • iOS 9 custom transition - animationControllerForDismissedController not called
  • UIScrollView setContentOffset: animated: not working
  • Why does Apple use assign rather than weak to store a delegate?
  • Negated scanset in fscanf and EOF
  • dismiss Progress Dialog in another Activity … Android
  • How to synchronize two scrollview in Android?
  • Should a web service response include empty values?
  • How do you create a Fuseki SPARQL server using the Apache Jena Java API?
  • EditText is covered by Keyboard
  • How to access profile picture with Facebook API in Swift 3?
  • UIAlertController button function not working
  • URLConnection doesn't work since API 10 and higher?
  • How to remove a SwiftyJSON element?
  • QLPreviewController hide print button in ios6
  • Row Count Is Returning the incorrect number using RaptureXML
  • Unity3D & Android: Difference between “UnityMain” and “main” threads?
  • Obtain ObjectIdHex value from mgo query
  • Sending data from AppleScript to FileMaker records
  • File upload with ng-file-upload throwing error
  • KeystoneJS: Relationships in Admin UI not updating
  • AngularJs get employee from factory
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • Load html files in TinyMce
  • Bitwise OR returns boolean when one of operands is nil
  • unknown Exception android