LoginSignup
0
0

More than 1 year has passed since last update.

インジケータの使い方

Last updated at Posted at 2022-10-28

設定

Storyboardを用いた場合、コードで変えれる部分が色ぐらいだと思います。(他にもおすすめの設定があればコメント頂けると幸いです。)

ViewController.swift
@IBOutlet private weak var indicator: UIActivityIndicatorView! {
    didSet {
        // 色指定(青)
        indicator.color = UIColor(red: 44 / 255, green: 169 / 255, blue: 225 / 255, alpha: 1)
    }
}

アクション

それぞれ行いたいタイミングで呼び出します。
インジケータは非同期処理と共によく用いられますが、その説明は別記事で紹介します。

ViewController.swift
// インジケータを表示
indicator.isHidden = false

// アニメーションを開始
indicator.startAnimating()

// インジケータを非表示
indicator.isHidden = true

// アニメーションを終了
indicator.startAnimating()
0
0
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
0