I am using http communication in My iPhone app. I want to show a progress bar while it is loading data from server. How can I do it programmatically?
I just want a d
To maintain this question totally updated I have translated @enrique7mc's answer to Swift3.0 following his translation from @Hiren's answer.
var indicator: UIActivityIndicatorView = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.gray)
indicator.frame = CGRect(x: 0.0, y: 0.0, width: 40.0, height: 40.0)
indicator.center = view.center
view.addSubview(indicator)
indicator.bringSubview(toFront: view)
UIApplication.shared.isNetworkActivityIndicatorVisible = true
To start and stop the progress bar is in the same way that @enrique7mc pointed out.
indicator.startAnimating()
indicator.stopAnimating()