How to show the loading indicator in the top status bar

后端 未结 8 2025
借酒劲吻你
借酒劲吻你 2020-12-04 06:37

I have noticed that some apps like Safari and Mail show a loading indicator in the status bar (the bar at the very top of the phone) when they are accessing the network. Is

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 07:15

    I've found the following macros pretty useful!

    #define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES
    #define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO
    

    So you can just call ShowNetworkActivityIndicator(); or HideNetworkActivityIndicator(); from within your app (as long as the header is included of course!).

提交回复
热议问题