Reputation: 11084
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 .
Upvotes: 38
Views: 23611
Reputation: 9652
Swift 4
UIApplication.shared.isNetworkActivityIndicatorVisible = true
Upvotes: 1
Reputation: 9157
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
Upvotes: -5
Reputation: 18290
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
Upvotes: 87
Reputation: 523
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
Upvotes: 1
Reputation: 1107
Same as above just in Swift:
UIApplication.sharedApplication().networkActivityIndicatorVisible = true
Upvotes: 6