0
5

More than 1 year has passed since last update.

進行状況を円形で表示する方法です

Feb-02-2022 11-35-07.gif

円形のプログレス・ビューを表示したい

棒状のProgressBarならUIKitにありますが、アプリなどでよくみる円形のProgressを表示したい。

KDCircularProgressでかんたんに表示

便利なライブラリを使ってかんたんに表示します。

リポジトリからKDCircularProgress.swiftファイルをプロジェクトにドラッグ&ドロップします。

CircularProgressをセットアップします。

var progress = KDCircularProgress(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
progress.startAngle = -90
progress.progressThickness = 0.2
progress.trackThickness = 0.6
progress.clockwise = true
progress.gradientRotateSpeed = 2
progress.roundedCorners = false
progress.glowMode = .forward
progress.glowAmount = 0.9
progress.set(colors: UIColor.cyan ,UIColor.white, UIColor.magenta, UIColor.white, UIColor.orange)
progress.center = CGPoint(x: view.center.x, y: view.center.y + 25)
view.addSubview(progress)

アニメーションをスタートします。

progress.animate(toAngle: 360, duration: 5, completion: nil)

Feb-02-2022 11-35-07.gif

GitHubを探そう

こういうライブラリっていっぱいあるので、好みのものを探してみましょう。

🐣


フリーランスエンジニアです。
お仕事のご相談こちらまで
rockyshikoku@gmail.com

Core MLやARKitを使ったアプリを作っています。
機械学習/AR関連の情報を発信しています。

Twitter
Medium

0
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
5