如何创建 Activity 指标视图?
How to create Activity Indicator View?
你能告诉我如何创建一个 Activity 指标视图吗?
我有一个普通按钮:
@IBAction func NextViewController(sender: AnyObject) {
}
我的应用加载下一个视图控制器需要很多时间,我希望有一个正常的指示器来通知用户稍等。
我可以建议你使用LilithProgressHUD。这是我用过的最好的 Activity 指标视图。
用 pod 'LilithProgressHUD'
安装它。
//Import LilithProgressHUD
import LilithProgressHUD
//Show the HUD
LilithProgressHUD.show()
//Hide the HUD
LilithProgressHUD.hide()
字面上就是这样...
所以在你的例子中:
@IBAction func NextViewController(sender: AnyObject) {
LilithProgressHUD.show()
}
就是这样......在 NextViewController
viewDidLoad 中你会调用 LilithProgressHUD.hide()
.
还有。我已经在我的 AppDelegate 中设置了视图的属性。
LilithProgressHUD.size = (self.window?.frame.size.height)! // sets the size to the size of my App
LilithProgressHUD.opacity = 0.75 // sets the opacity nice to a value where you can slightly see the App
你能告诉我如何创建一个 Activity 指标视图吗? 我有一个普通按钮:
@IBAction func NextViewController(sender: AnyObject) {
}
我的应用加载下一个视图控制器需要很多时间,我希望有一个正常的指示器来通知用户稍等。
我可以建议你使用LilithProgressHUD。这是我用过的最好的 Activity 指标视图。
用 pod 'LilithProgressHUD'
安装它。
//Import LilithProgressHUD
import LilithProgressHUD
//Show the HUD
LilithProgressHUD.show()
//Hide the HUD
LilithProgressHUD.hide()
字面上就是这样...
所以在你的例子中:
@IBAction func NextViewController(sender: AnyObject) {
LilithProgressHUD.show()
}
就是这样......在 NextViewController
viewDidLoad 中你会调用 LilithProgressHUD.hide()
.
还有。我已经在我的 AppDelegate 中设置了视图的属性。
LilithProgressHUD.size = (self.window?.frame.size.height)! // sets the size to the size of my App
LilithProgressHUD.opacity = 0.75 // sets the opacity nice to a value where you can slightly see the App