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.

4

5 回答 5

86

我认为您正在寻找的是:

[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

斯威夫特 3

UIApplication.shared.isNetworkActivityIndicatorVisible = true

如此处的文档: https ://developer.apple.com/documentation/uikit/uiapplication/1623102-isnetworkactivityindicatorvisibl

于 2012-06-17T01:10:42.290 回答
6

与上面在 Swift 中的相同:

UIApplication.sharedApplication().networkActivityIndicatorVisible = true
于 2016-01-26T12:00:46.920 回答
1

对于任何寻找答案的人来说,Swift 3,您只需将属性设置isNetworkActivityIndicatorVisibleUIApplicationtrue。

例如在didFinishLaunchingWithOptons应用程序委托的函数中:

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

    return true
}

这基本上意味着:

UIApplication.sharedApplication().isNetworkActivityIndicatorVisible = true
于 2016-10-19T14:59:20.677 回答
1

斯威夫特 4

UIApplication.shared.isNetworkActivityIndicatorVisible = true
于 2019-04-14T21:44:56.243 回答
-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

于 2012-06-17T00:55:56.427 回答