11# ButtonClickStyle
22
3- ![ image] ( https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/all_ipad_random .gif )
3+ ![ image] ( https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/preview_10sec33fps .gif )
44
55This is a view button
66
@@ -29,29 +29,27 @@ You can expand the project adding new click-animation-styles
29293 ) In Attributes Inspector of Interface Builder
3030 you can immediately select the button click ` animationType `
3131``` swift
32- #type #name
33-
34- enum Style {
35- # hide
36- case alpha
37- case flash // alpha flicker
38- # add
39- case shadow
40- case shadowColor
41- case color
42- case colorFlat // border text
43- # move
44- case pulsateNew
45- case pulsate
46- case press
47- case shakeNew
48- case shake
49- # add pulsate
50- case androidClickableDark
51- case androidClickableLigt
52- }
32+ extension ButtonClick {
33+ enum Style {
34+ case alpha
35+ case flash
36+ case shadow
37+ case shadowColor
38+ case color
39+ case colorFlat
40+ case pulsateNew
41+ case pulsate
42+ case press
43+ case shake
44+ case shakeNew
45+ case androidClickable
46+ case androidClickableDark
47+ }
48+ }
5349```
5450
51+ ![ image] ( https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/click_styles_example_2x_10sec33fps.gif )
52+
55534 ) Also you can select specific layers to animate / or just 1 specific one ` allSubviews `
5654
5755
@@ -72,27 +70,32 @@ enum Style {
7270var addViews: [UIView]?
7371```
7472
75- ! [ image] ( https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/ui3.gif )
73+ <!-- ! [image](https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/ui3.gif) -->
7674
77757 ) If initializing programmatically
7876There is a property ` addViews ` - allows you to pass views / layers
7977which you definitely want to use in the click animation only
8078
81- 8 ) Or initialize through a struct ` BtnCellState `
79+ 8 ) Or initialize through a struct ` ButtonClick.State `
8280
8381``` swift
84- struct BtnCellState : Equatable {
85- var titleText: String ?
86- var allSubviews: Bool = true
87- var animationType: Int ?
88- var animationTypeValue: CGFloat?
89- var animationDuration: CGFloat?
90- var new: Bool = false
91- var color: UIColor?
92- var addBackgrondColor: Bool = true
82+ extension ButtonClick {
83+ struct State : Equatable {
84+ var titleText: String ?
85+ var allSubviews: Bool = true
86+ var animationType: Int ?
87+ var animationTypeValue: CGFloat?
88+ var animationDuration: CGFloat?
89+ var new: Bool = false
90+ var color: UIColor?
91+ var startClick: Bool = false
92+ var addBackgrondColor: Bool = true
93+ }
9394}
9495```
9596
97+ ![ image] ( https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/ui3.gif )
98+
9699``` swift
97100@IBOutlet var mainView: UIView!
98101
0 commit comments