LoginSignup
2
2

More than 5 years have passed since last update.

タブを選択した時にシンプルなアニメーションを追加する

Last updated at Posted at 2017-03-04

20170303.gif

UITabBarItemをUIViewにキャストします。


    override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {


        let v = item.value(forKey: "view") as! UIView

        v.echo()
    }


アニメーションは別ファイルで実装する方法を最近知りました。
ソースが見やすくなっていいですね。

Animation.swift

import UIKit

extension UIView {


   func echo() {

        // CABasicAnimationを実装してCALayerに追加する
     }


}

ソースはこちら。AnimatedTabBarSample

参考

RAMAnimatedTabBarController
超使いやすいです。

2
2
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
2
2