ios - UIProgressView 向后进展
问题描述
当语言是 LTR 时,我有这个进度条可以完美运行。但是当语言是 RTL 时开始倒退然后前进。
func AnimateTimerPath(inViewController vc:UIViewController,Duration:TimeInterval){
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.BarAnimation = UIViewPropertyAnimator.init(duration: Duration, curve: .linear) {
self.ProgressBar.setProgress(1, animated: true)
self.ProgressBar.layoutIfNeeded()
}
self.BarAnimation.startAnimation()
}
}
private func BuildTimeBar(inViewController vc:UIViewController){
ProgressBar.frame = CGRect(x: .zero, y: .zero,
width: vc.view.frame.width-40, height: 4)
ProgressBar.trackTintColor = .lightGray
ProgressBar.progressTintColor = .white
ProgressBar.center = CGPoint(x: vc.view.frame.midX, y: 80)
ProgressBar.setProgress(0, animated: false)
ProgressBar.progressViewStyle = .default
if Locale.preferredLanguages[0] == "he" || Locale.preferredLanguages[0] == "ar"{
self.ProgressBar.transform = .identity.rotated(by: .pi)
}
vc.view.addSubview(ProgressBar)
}
我使用UIViewPropertyAnimator
暂停中间动画。它使用UIView.animate
解决方案
推荐阅读
- python - 使用 Pydantic 嵌套模型从 FastAPI 获取 JSON
- javascript - 当数据为 NULL 时如何使用 React 在 HTML 上隐藏元素
- javascript - 如何在 Photoshop 脚本中运行“快速操作”?
- javascript - 如何将一些 wasm 文件用于不依赖于 wasm-pack 的其他 javascript 项目?
- camera-calibration - 从鱼眼图像中采样透视(子)视图
- javascript - 执行多个 MySQL 查询相互依赖节点 js
- flutter - 将数据从一个屏幕传回另一个屏幕
- python - 我的深度学习模型不是训练。我如何让它训练?
- java - 如何获取 IntelliJ 2020.02 用于运行 Java 配置的实际命令
- javascript - 如何在使用 Firebase 函数时更正“请求的资源上不存在‘Access-Control-Allow-Origin’标头”错误?