I am using NVActivityIndicatorView
as a spinner in my project. When I decided to go back, I am waiting until the spinner stops. So I have to go back while spinner is loading.
import UIKit
import NVActivityIndicatorView
import Foundation
class Utilities: UIViewController,NVActivityIndicatorViewable
{
func startprogress()
{
let size = CGSize(width: 30, height: 30)
startAnimating(size, message: nil, type:
NVActivityIndicatorType(rawValue: 12)!)
}
func stopprogress() {
self.stopAnimating()
}
}
In my view controller:
override func viewDidLoad() {
super.viewDidLoad()
Utilities().startprogress()
apiMethod()
}
after my response success I am stopping activity indicator
func apiMethod()
{
let onSuccess: ((_: NSDictionary) -> Void)? = {(_ response: NSDictionary) -> Void in
print(response)
Utilities().stopprogress()
}
Here I am facing issue is I have to wait until the indicator stops to go back.
You are applying the activityIndicator
on the main UIWindow. you have to add that activityIndicator
on only the particular UIViewController
. If you need any help regarding that, refer following links.
https://github.com/ninjaprox/NVActivityIndicatorView/issues/191 https://github.com/ninjaprox/NVActivityIndicatorView/issues/174 NVActivityIndicatorView only for particular view
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.