2

Just out of curiosity what kind of network activity causes the spinner in the status bar to spin? It never spins in my app even when data is being fetched. In Instagram, it always spins when data is being fetched.

enter image description here

enter image description here

Edit: To clarify that this question is not a duplicate. I am wondering what makes the loading indicator appear in the status bar, not just how to make it appear. Is it common to call UIApplication.shared.isNetworkActivityIndicatorVisible = true every time a call is made to the server?

Peter Tao
  • 1,668
  • 6
  • 18
  • 29

2 Answers2

0

Hi you can show network indicator every time you make a call to web service. You can show network indicator with

UIApplication.sharedApplication().networkActivityIndicatorVisible = true

and remove it when you received response from web service with

UIApplication.sharedApplication().networkActivityIndicatorVisible = false
Devang Tandel
  • 2,988
  • 1
  • 21
  • 43
0

for Swift 2.0

UIApplication.sharedApplication().networkActivityIndicatorVisible = true
UIApplication.sharedApplication().networkActivityIndicatorVisible = false

for Swift 3.0

UIApplication.shared.isNetworkActivityIndicatorVisible = true
UIApplication.shared.isNetworkActivityIndicatorVisible = false
anshul king
  • 558
  • 4
  • 17