Pregunta

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.

¿Fue útil?

Solución

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

Otros consejos

Same as above just in Swift:

UIApplication.sharedApplication().networkActivityIndicatorVisible = true

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

Swift 4

UIApplication.shared.isNetworkActivityIndicatorVisible = true

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top