|
1 | | -# ButtonCustomButtonClickStyle |
| 1 | +# ButtonClickStyle |
| 2 | + |
| 3 | +## Preview |
| 4 | + |
2 | 5 |
|
3 | 6 | Это слой кнопка |
4 | | - которая имеет 8 стилей анимированного нажатия |
| 7 | + которая имеет 9 стилей анимированного нажатия |
5 | 8 |
|
6 | 9 | Внутри Слоя |
7 | 10 | можно создавать свои собственные кнопки |
|
12 | 15 |
|
13 | 16 | ## Requirements |
14 | 17 |
|
15 | | -- iOS 8.0+ |
16 | | -- Xcode 9+ |
| 18 | +macOS 10.12+ |
| 19 | +Xcode 13+ |
| 20 | +Swift 5.5+ |
17 | 21 |
|
18 | 22 | ## Installation |
19 | 23 |
|
20 | | -For manual instalation, drag Source folder into your project. |
21 | | - |
22 | | -os use [CocoaPod](https://cocoapods.org) adding this line to you `Podfile`: |
23 | | - |
24 | | -```ruby |
25 | | -pod 'ButtonCustomButtonClickStyle' |
26 | | -``` |
27 | | - |
28 | | -for [Carthage](https://github.com/Carthage/Carthage) users, add this line to you `Cartfile` |
29 | 24 |
|
30 | | -```ruby |
31 | | -github "mrustaa/ButtonCustomButtonClickStyle" |
32 | | -``` |
| 25 | +## Usage |
33 | 26 |
|
34 | | -### Swift Package Manager |
| 27 | +#### С storyboard или xib |
35 | 28 |
|
36 | | -The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. |
| 29 | +1) Создайте вьюшку, которая наследуется `ButtonClickStyleView` |
37 | 30 |
|
38 | | -Once you have your Swift package set up, adding as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`. |
| 31 | +<!--You can now style your button (Теперь вы можете стилизовать свою кнопку )--> |
| 32 | +2) Внутри этого слоя, создавайте свою собственную кнопку из других слоев |
39 | 33 |
|
| 34 | +3) В атрибутых инспектора (`Attributes Inspector` of `Interface Builder`)а |
| 35 | + вы можете сразу выбрать тип анимации нажатия кнопки `animationType` |
| 36 | + |
| 37 | + Пока 9 стилей анимированного нажатия |
40 | 38 | ```swift |
41 | | -dependencies: [ |
42 | | - .package(url: "https://github.com/sparrowcode/SPQRCode", .upToNextMajor(from: "1.0.4")) |
43 | | -] |
| 39 | +#type #name |
| 40 | + |
| 41 | +"Hide .Alpha" |
| 42 | +"Hide .Flash (more)" |
| 43 | +"Add .Shadow" |
| 44 | +"Add .Color" |
| 45 | +"Add .ColorFlat (border text)" |
| 46 | +"Move .Pulsate (new)" |
| 47 | +"Move .Pulsate" |
| 48 | +"Move .Press" |
| 49 | +"Move .Shake (new)" |
| 50 | +"Move .Shake" |
| 51 | +"Add .AndroidClickable (dark)" |
| 52 | +"Add .AndroidClickable (ligth)" |
44 | 53 | ``` |
45 | 54 |
|
| 55 | +4) Так же вы можете выбрать анимировать все слои `allSubviews` / или только 1 |
46 | 56 |
|
47 | | -### Swift Package Manager |
48 | 57 |
|
49 | | -[Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. |
| 58 | +5) Добавить + animation.Duration - время анимации |
50 | 59 |
|
51 | | -> Xcode 11+ is required to build Harbeth using Swift Package Manager. |
| 60 | +6) Добавить + animation.Value - под значением имеется ввиду |
| 61 | + у анимации тип |
| 62 | + - "Hide .Alpha/Flash/Shadow/Color" будет меняться альфа от 0.0 до 1.0 |
| 63 | + - "Move .Pulsate/Press/Shake" будет движения усиливаться уменьшаться от 0.0 до 1.0 |
| 64 | + - "Add .AndroidClickable" будет увелмчиваться радиус пузырей |
52 | 65 |
|
53 | | -To integrate Harbeth into your Xcode project using Swift Package Manager, add it to the dependencies value of your `Package.swift`: |
54 | 66 |
|
55 | 67 | ```swift |
56 | | -dependencies: [ |
57 | | - .package(url: "https://github.com/yangKJ/Harbeth", .upToNextMajor(from: "0.1.15")), |
58 | | -] |
59 | | -``` |
60 | | - |
| 68 | +@IBInspectable var allSubviews: Bool = true |
| 69 | +@IBInspectable var animationType: Int = |
| 70 | +@IBInspectable var animationValue: CGFloat = 0.0 |
| 71 | +@IBInspectable var animationDuration: CGFloat = 0.0 |
| 72 | + |
| 73 | +var addViews: [UIView]? |
61 | 74 |
|
| 75 | +``` |
| 76 | +7) Если иниализацируйие программно |
| 77 | + - Есть свойство `addViews` - позволяет передать вьшки/слои |
| 78 | + которые вы точно захотите задейстовать в анимации нажатия only |
62 | 79 |
|
63 | | -## Usage |
64 | | - |
65 | | -#### With storyboard or xib files |
66 | | - |
67 | | -1) Create a Button that inherits from `Button` |
68 | | - |
69 | | -2) Add Image for a `Normal` state |
70 | | - |
71 | | -3) Set the `IBOutlet` delegate property to a subclass of `ButtonDelegate` |
72 | | - |
73 | | -4) ___Optional___ manipulate porperties to change button settings |
74 | 80 |
|
75 | 81 | ```swift |
76 | | -@IBInspectable public var normalColor: UIColor |
77 | | -@IBInspectable public var selectedColor: UIColor |
78 | | -@IBInspectable public var dotFirstColor: UIColor |
79 | | -@IBInspectable public var dotSecondColor: UIColor |
80 | | -@IBInspectable public var circleFromColor: UIColor |
81 | | -@IBInspectable public var circleToColor: UIColor |
| 82 | +let btnView = ButtonClickStyleView( |
| 83 | + frame: @frame, |
| 84 | + animation: @type, |
| 85 | + value: @value, |
| 86 | + addViews: @views, |
| 87 | +) |
| 88 | +btnView.insertSubview(self.view, at: 0) |
| 89 | +btnView.updateSubviews() |
| 90 | + |
82 | 91 | ``` |
83 | 92 |
|
| 93 | + |
| 94 | + |
84 | 95 | ## Credits |
85 | 96 |
|
86 | 97 |
|
87 | 98 | ## License |
88 | 99 |
|
89 | | -ButtonCustomButtonClickStyle is released under the MIT license. |
| 100 | +ButtonClickStyle is released under the MIT license. |
90 | 101 |
|
0 commit comments