LoginSignup
25
26

More than 5 years have passed since last update.

Material Button with Swift

冬季休暇の勝手宿題として使えそうなライブラリでも作ってみようと思いたち、第二弾として
AndroidのMaterialデザインで採用されているボタンのアニメーションをiOSで利用出来る様にSwiftで作成しました。

material_button_cross.gif

material_button_arrow.gif

Ripple button usage

self.rippleButton = RippleButton()
self.rippleButton.setTitle("Ripple Button", forState: UIControlState.Normal)
self.rippleButton.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
self.rippleButton.backgroundColor = UIColor(red: 240.0 / 255.0, green: 240.0 / 255.0, blue: 240.0 / 255.0, alpha: 1.0)
self.rippleButton.frame = CGRect(x: 30.0, y: 100.0, width: 200.0, height: 40.0)
self.view.addSubview(self.rippleButton)

Animation button usage

var materialButton1 =  MaterialButton(type: MaterialButtonType.ArrowLeft)
materialButton1.delegate = self
self.navigationItem.leftBarButtonItem = materialButton1

var materialButton2 =  MaterialButton(type: MaterialButtonType.ArrowRight)
materialButton2.delegate = self
self.navigationItem.rightBarButtonItem = materialButton2
MaterialButtonType
Cross
ArrowLeft
ArrowRight

ソースコードはこちらです

25
26
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
25
26