gpt4 book ai didi

iphone - AlamofireNetworkActivityIndi​​cator 不工作

转载 作者:搜寻专家 更新时间:2023-11-01 06:17:19 25 4
gpt4 key购买 nike

我在我的项目中通过 pod 集成了 AlamofireSwiftyJsonAlamofireNetworkActivityIndi​​cator 框架。按照 Github 页面中给出的说明操作后,AlamofireNetworkActivityIndi​​cator 未显示。 https://github.com/Alamofire/AlamofireNetworkActivityIndicator

它表示事件指示器工作所需的全部是以下代码行:

NetworkActivityIndicatorManager.shared.isEnabled = true

我基本上只需要一个事件指示器来显示何时发出请求或正在加载数据(Alamofire 方法)

最佳答案

其实你误会了 AlamofireNetworkActivityIndi​​cator 并不是像 MBProgressHUDSVProgressHUD 这样的 UIActivityIndi​​cator。当有 API 调用时,它会在状态栏中显示一个微调框。

这将用于显示 NetworkActivityIndi​​catorManager.shared.isEnabled = truefalse 将从状态栏中隐藏。

//Using MBProgressHUD
//Show indicator
MBProgressHUD.showHUDAddedTo(self.view, animated: true)
Alamofire.request(.POST, URL, parameters: parameter, encoding: .JSON)
.responseJSON { response in
//Hide indicator
MBProgressHUD.hideAllHUDsForView(self.view, animated: true)
}

关于iphone - AlamofireNetworkActivityIndi​​cator 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41711658/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com