38

I'm trying to figure out what the loading circle animation in the status bar is. A lot of apps, when they load data, have a spinner in the status bar to indicate that the app is loading data, but I can't figure out what its called to implement it. Can someone tell me what it is called?

If you don't know what I'm talking about, but have an iOS device, try loading a web page in Safari and look at the spinner in the status bar. Thats what I'm talking about.

Here is an screenshot I took Its the spinner in the statusbar.

pnuts
  • 58,317
  • 11
  • 87
  • 139
RileyE
  • 10,874
  • 13
  • 63
  • 106

5 Answers5

87

I think what you are looking for is:

[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

Swift 3

UIApplication.shared.isNetworkActivityIndicatorVisible = true

as doc'd here: https://developer.apple.com/documentation/uikit/uiapplication/1623102-isnetworkactivityindicatorvisibl

Cœur
  • 37,241
  • 25
  • 195
  • 267
Chris Trahey
  • 18,202
  • 1
  • 42
  • 55
6

Same as above just in Swift:

UIApplication.sharedApplication().networkActivityIndicatorVisible = true
RhodanV5500
  • 1,087
  • 12
  • 16
1

For anyone looking for the answer to this is Swift 3, you just set the property isNetworkActivityIndicatorVisible on UIApplication to true.

For instance in the didFinishLaunchingWithOptons function in the app delegate:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {        // Override point for customization after application launch.
    application.isNetworkActivityIndicatorVisible = true

    return true
}

Which basically means:

UIApplication.sharedApplication().isNetworkActivityIndicatorVisible = true
16patsle
  • 513
  • 7
  • 12
1

Swift 4

UIApplication.shared.isNetworkActivityIndicatorVisible = true
Evgeny Karkan
  • 8,782
  • 2
  • 32
  • 38
-5

It is UIActivityIndicatorView. You can check out its documentation and learn more here: UIActivityIndicatorView

Also, to put it on the status bar, check out this link: Activity Monitor Status Bar

Cœur
  • 37,241
  • 25
  • 195
  • 267
MCKapur
  • 9,127
  • 9
  • 58
  • 101
  • Do I have to add that to the status bar? – RileyE Jun 17 '12 at 00:57
  • 1
    Yes. But how nearly every application has it, in the status bar, would I have to add it there myself, or is there a method to call in the UIApplication class methods? – RileyE Jun 17 '12 at 00:59
  • Basically, I don't know how I would add it to the statusbar, since I don't know how far the connection information spans across the bar. – RileyE Jun 17 '12 at 01:01
  • I don't think you can put it on the status bar – MCKapur Jun 17 '12 at 01:02
  • 1
    Actually maybe you can. Try checking out this link: http://www.iphonedevsdk.com/forum/iphone-sdk-development/1972-activitymonitor-status-bar.html – MCKapur Jun 17 '12 at 01:02
  • Oh. Then its not the view I'm looking for. Check out my screenshot in my original post. Any thoughts? – RileyE Jun 17 '12 at 01:02
  • Thats it! Can you post that as an answer? That way people can see the answer quicker. – RileyE Jun 17 '12 at 01:08
  • Sorry. Do you mind answering it with this exact link as a new answer? (http://www.iphonedevsdk.com/forum/iphone-sdk-development/1972-activitymonitor-status-bar.html#post11466) – RileyE Jun 17 '12 at 01:11
  • I have to give the correct answer to CT, since his is clearer for other viewers. – RileyE Jun 17 '12 at 01:13
  • I did give you a vote, though! Thanks for your help. It was really fast and concise! – RileyE Jun 17 '12 at 01:15