0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[初心者向け]UITableViewでCellのハイライトをゆっくりと消す方法(画面遷移した先から戻ってきたタイミングで)

Posted at

#はじめに
・Swift5,Xcode11.6を使用しています。

#できること

・UITableView上でCellを選択したときにゆっくりとハイライトさせる
・画面遷移先から戻ってきたときに、ゆっくりとハイライトを終わらせる

swift
 override func viewWillAppear(_ animated: Bool) {
        navigationController?.isNavigationBarHidden = true

        //ゆっくり付けたり消したりする
        if let indexPathForSelectedRow = tableView.indexPathForSelectedRow {
            tableView.deselectRow(at: indexPathForSelectedRow, animated: true)
        }
    }

#結果
以下のような効果のハイライトが実装できます。
N0PFF6c49xCIBZmrkbWF1598155405-1598155417.gif

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?