NVActivityIndi​​catorView启动时如何返回?

时间:2019-04-02 09:18:56

标签: swift

我在项目中使用NVActivityIndicatorView作为微调器。当我决定返回时,我一直等到微调器停止。所以我必须在微调器加载时返回。

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()
    }
}

在我的视图控制器中:

override func viewDidLoad() {
    super.viewDidLoad()

    Utilities().startprogress()
    apiMethod()
}

响应成功后,我将停止活动指示器

func apiMethod()
{


    let onSuccess: ((_: NSDictionary) -> Void)? = {(_ response: NSDictionary) -> Void in

        print(response)
        Utilities().stopprogress()

    }

这里我面临的问题是我必须等到指示器停止返回。

enter image description here

1 个答案:

答案 0 :(得分:0)

您正在将activityIndicator应用于主UIWindow。您只需在特定的activityIndicator上添加UIViewController。 如果您需要任何帮助,请参考以下链接。

https://github.com/ninjaprox/NVActivityIndicatorView/issues/191 https://github.com/ninjaprox/NVActivityIndicatorView/issues/174 NVActivityIndicatorView only for particular view

相关问题