如何隐藏屏幕的加载指示器?
How to hide loading indicator of screen?
我正试图将加载指示器隐藏在屏幕外的左侧。现在它正在部分显示,如 GIF 中所示。我该如何解决?
refreshIndicator = NVActivityIndicatorView(frame: .zero, type: .circleStrokeSpin, color: Constants.loadingIndictorColor)
refreshIndicator.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(refreshIndicator)
refreshIndicator.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.size.equalTo(Constants.loadingIndicatorSize)
refreshConstaints = make.right.equalTo(view.snp.left).offset(sideInset).constraint
}
refreshIndicator.startAnimating()
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let offSet = scrollView.contentOffset.x
if offSet < (sideInset) {
refreshConstaints?.update(inset:-offSet)
}
// if offSet > +100{
// refreshIndicator.stopAnimating()
// }
else{
refreshIndicator.stopAnimating()
}
}
尝试在 AttributesInspector 中设置“停止时隐藏”
或在代码中
refreshIndicator.hidesWhenStopped = true
我正试图将加载指示器隐藏在屏幕外的左侧。现在它正在部分显示,如 GIF 中所示。我该如何解决?
refreshIndicator = NVActivityIndicatorView(frame: .zero, type: .circleStrokeSpin, color: Constants.loadingIndictorColor)
refreshIndicator.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(refreshIndicator)
refreshIndicator.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.size.equalTo(Constants.loadingIndicatorSize)
refreshConstaints = make.right.equalTo(view.snp.left).offset(sideInset).constraint
}
refreshIndicator.startAnimating()
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let offSet = scrollView.contentOffset.x
if offSet < (sideInset) {
refreshConstaints?.update(inset:-offSet)
}
// if offSet > +100{
// refreshIndicator.stopAnimating()
// }
else{
refreshIndicator.stopAnimating()
}
}
尝试在 AttributesInspector 中设置“停止时隐藏”
或在代码中
refreshIndicator.hidesWhenStopped = true