LoginSignup
0
1

More than 5 years have passed since last update.

Swift3でボタンを揺らす簡単なサンプル

Posted at

IBOutletで接続

@IBOutlet weak var Button: UIButton!

viewDidLoad() 内で実行

UIView.animate(withDuration: 0.6,
                       animations: {
                        self.Button.transform = CGAffineTransform(scaleX: 0.6, y: 0.6)
        },
                       completion: { _ in
                        UIView.animate(withDuration: 0.6) {
                            self.Button.transform = CGAffineTransform.identity
                        }
        })

参考

Scale UIButton Animation- Swift

Swift3でボタンを揺らす簡単なサンプル

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