Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 32ac332

Browse files
rsomletteshashankpali
authored andcommitted
Update README.md
1 parent 30d49a9 commit 32ac332

File tree

1 file changed

+109
-109
lines changed

1 file changed

+109
-109
lines changed

README.md

Lines changed: 109 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,121 @@
1-
![EZYGradientView](Assets/GitBanner.png)
2-
3-
`EZYGradientView` is a different and unique take on creating gradients and gradients with blur on the iOS platform. The default `CAGradientLayer` implementation works just fine, but is confusing and gives different results than expected. From the documentation:
4-
5-
> The start point corresponds to the first stop of the gradient. The point is defined in the unit coordinate space and is then mapped to the layer’s bounds rectangle when drawn.
6-
7-
It's not really clear what the mapped values for the start and end points will be. If we set the start x coordinate 0.2, it does not resolve to 0.2 of the view's width on the X-axis.
8-
9-
This library attempts to create gradients intuitively. When you use `EZYGradientView`, you don't need to worry about Apple's default API. What you do need to concern yourself with is:
10-
11-
* What your colors are
12-
* The angle of the gradient
13-
* The ratio in which the two colors are distributed; and finally...
14-
* The intensity with which the colors are dispersed
15-
16-
`EZYGradientView` exposes five properties you can modify to customize your gradient. The view itself is `IBDesignable` and its properties `IBInspectable` which means you can customize your gradient in real time on an xib or storyboard.
17-
1+
![EZYGradientView](Assets/GitBanner.png)
2+
3+
`EZYGradientView` is a different and unique take on creating gradients and gradients with blur on the iOS platform. The default `CAGradientLayer` implementation works just fine, but is confusing and gives different results than expected. From the documentation:
4+
5+
> The start point corresponds to the first stop of the gradient. The point is defined in the unit coordinate space and is then mapped to the layer’s bounds rectangle when drawn.
6+
7+
It's not really clear what the mapped values for the start and end points will be. If we set the start x coordinate 0.2, it does not resolve to 0.2 of the view's width on the X-axis.
8+
9+
This library attempts to create gradients intuitively. When you use `EZYGradientView`, you don't need to worry about Apple's default API. What you do need to concern yourself with is:
10+
11+
* What your colors are
12+
* The angle of the gradient
13+
* The ratio in which the two colors are distributed; and finally...
14+
* The intensity with which the colors are dispersed
15+
16+
`EZYGradientView` exposes five properties you can modify to customize your gradient. The view itself is `IBDesignable` and its properties `IBInspectable` which means you can customize your gradient in real time on an xib or storyboard.
17+
1818
# Pod Installation
1919

2020
CocoaPods is the preferred way to install this library. Add this command to your `Podfile`:
2121

2222
```
23-
pod 'EZYGradientView'
24-
```
25-
26-
27-
28-
29-
###For [Objective C](https://github.com/shashankpali/EZYGradientView-ObjC)
30-
23+
pod 'EZYGradientView', :git => 'https://github.com/Niphery/EZYGradientView'
24+
```
25+
26+
27+
28+
29+
###For [Objective C](https://github.com/shashankpali/EZYGradientView-ObjC)
30+
3131

3232
# Direct Installation
3333

3434
Download .zip file and extract it. There you will find the `EZYGradientView` folder, copy EZYGradientView.swift to your respective project.
3535

36-
# Integration Methods
37-
38-
## Storyboard/Xib
39-
40-
Just follow these simple steps and create a gradient inside your xib or storyboard!
41-
42-
43-
### Initial Step (Use this step if downloaded by pod)
44-
45-
###### while assigning EZYGradientView to UIView on StoryBoard/Xib don't forget to select module
46-
47-
| Step | Description |
48-
|-------------------------------|---------------------------------------------------|
49-
| ![Step 0a](Assets/Step0a.png) | |
50-
| ![Step 0b](Assets/Step0b.png) | It will reflect warning if module is not selected.|
51-
52-
### Step 1 - Select colors
53-
54-
| Step | Description |
55-
|-------------------------------|---------------|
56-
| ![Step 1a](Assets/Step1a.png) | |
57-
| ![Step 1b](Assets/Step1b.png) | |
58-
59-
### Step 2 - Set gradient angle
60-
61-
| Step | Description |
62-
|-------------------------------|----------------|
63-
| ![Step 2a](Assets/Step2a.png) | Default is 0º. |
64-
| ![Step 2b](Assets/Step2b.png) | At 45º. |
65-
| ![Step 2c](Assets/Step2c.png) | At 135º. |
66-
67-
### Step 3 - Set color ratio
68-
69-
| Step | Description |
70-
|-------------------------------|-----------------------------------------------------------------------------------------------|
71-
| ![Step 3a](Assets/Step3a.png) | Default is 0.5, that's why colors are equally divided. Valid range 0 to 1. |
72-
| ![Step 3b](Assets/Step3b.png) | At 0.1, the first color takes one-tenth of the view area. The rest is filled by the second. |
73-
| ![Step 3c](Assets/Step3c.png) | At 0.9, the first color takes nine-tenths of the view area. The rest is filled by the second. |
74-
75-
### Step 4 - Set fade intensity
76-
77-
| Step | Description |
78-
|-------------------------------|---------------------------------------------------------------------------------------------------|
79-
| ![Step 4a](Assets/Step4a.png) | Default is 0, that's why there is a sharp boundary where the two colors meet. Valid range 0 to 1. |
80-
| ![Step 4b](Assets/Step4b.png) | At 0.5, there is a much smoother transition between the two colors. |
81-
| ![Step 4c](Assets/Step4c.png) | At 1, the maximum transition smoothness is achieved. |
82-
83-
### Step 5 - Set isBlur and blur opacity
84-
######(This feature is available for ios 8 and above)
85-
86-
87-
| Step | Description |
88-
|-------------------------------|---------------------------------------------------------------------------------------------------|
89-
| ![Step 5a](Assets/Step5a.png) | Default is 0, where the blur transparency is minimmum. Valid range 0 to 1. |
90-
| ![Step 5b](Assets/Step5b.png) | At 1.0, where the blur transparency is maximum.(The black spot is a label behind gradient view) |
91-
| Suggestion | Use this properties to design `navigationBar`, `tabBar`, `tableHeaderView` etc. |
92-
93-
## Programmatic way
94-
95-
```swift
96-
let gradientView = EZYGradientView()
97-
gradientView.frame = view.bounds
98-
gradientView.firstColor = UIColor(red: 0.5, green: 0.0, blue: 1.0, alpha: 1.0)
99-
gradientView.secondColor = UIColor(red: 0.4, green: 1.0, blue: 0.8, alpha: 1.0)
100-
gradientView.angleº = 185.0
101-
gradientView.colorRatio = 0.5
102-
gradientView.fadeIntensity = 1
103-
gradientView.isBlur = true
104-
gradientView.blurOpacity = 0.5
105-
106-
view.insertSubview(gradientView, atIndex: 0)
107-
```
108-
109-
# To-do
110-
111-
* Allow more than two colors to create gradients.
112-
* It may crash if blur properties used in lower version than ios 8.
113-
* Use CoreGraphics blur to replace `UIVisualEffectView`.
114-
115-
# Thanks
116-
117-
* To [Sudeep Jaiswal](https://github.com/sudeepjaiswal) for motivating and special thanks for the documentation and ideas.
118-
36+
# Integration Methods
37+
38+
## Storyboard/Xib
39+
40+
Just follow these simple steps and create a gradient inside your xib or storyboard!
41+
42+
43+
### Initial Step (Use this step if downloaded by pod)
44+
45+
###### while assigning EZYGradientView to UIView on StoryBoard/Xib don't forget to select module
46+
47+
| Step | Description |
48+
|-------------------------------|---------------------------------------------------|
49+
| ![Step 0a](Assets/Step0a.png) | |
50+
| ![Step 0b](Assets/Step0b.png) | It will reflect warning if module is not selected.|
51+
52+
### Step 1 - Select colors
53+
54+
| Step | Description |
55+
|-------------------------------|---------------|
56+
| ![Step 1a](Assets/Step1a.png) | |
57+
| ![Step 1b](Assets/Step1b.png) | |
58+
59+
### Step 2 - Set gradient angle
60+
61+
| Step | Description |
62+
|-------------------------------|----------------|
63+
| ![Step 2a](Assets/Step2a.png) | Default is 0º. |
64+
| ![Step 2b](Assets/Step2b.png) | At 45º. |
65+
| ![Step 2c](Assets/Step2c.png) | At 135º. |
66+
67+
### Step 3 - Set color ratio
68+
69+
| Step | Description |
70+
|-------------------------------|-----------------------------------------------------------------------------------------------|
71+
| ![Step 3a](Assets/Step3a.png) | Default is 0.5, that's why colors are equally divided. Valid range 0 to 1. |
72+
| ![Step 3b](Assets/Step3b.png) | At 0.1, the first color takes one-tenth of the view area. The rest is filled by the second. |
73+
| ![Step 3c](Assets/Step3c.png) | At 0.9, the first color takes nine-tenths of the view area. The rest is filled by the second. |
74+
75+
### Step 4 - Set fade intensity
76+
77+
| Step | Description |
78+
|-------------------------------|---------------------------------------------------------------------------------------------------|
79+
| ![Step 4a](Assets/Step4a.png) | Default is 0, that's why there is a sharp boundary where the two colors meet. Valid range 0 to 1. |
80+
| ![Step 4b](Assets/Step4b.png) | At 0.5, there is a much smoother transition between the two colors. |
81+
| ![Step 4c](Assets/Step4c.png) | At 1, the maximum transition smoothness is achieved. |
82+
83+
### Step 5 - Set isBlur and blur opacity
84+
######(This feature is available for ios 8 and above)
85+
86+
87+
| Step | Description |
88+
|-------------------------------|---------------------------------------------------------------------------------------------------|
89+
| ![Step 5a](Assets/Step5a.png) | Default is 0, where the blur transparency is minimmum. Valid range 0 to 1. |
90+
| ![Step 5b](Assets/Step5b.png) | At 1.0, where the blur transparency is maximum.(The black spot is a label behind gradient view) |
91+
| Suggestion | Use this properties to design `navigationBar`, `tabBar`, `tableHeaderView` etc. |
92+
93+
## Programmatic way
94+
95+
```swift
96+
let gradientView = EZYGradientView()
97+
gradientView.frame = view.bounds
98+
gradientView.firstColor = UIColor(red: 0.5, green: 0.0, blue: 1.0, alpha: 1.0)
99+
gradientView.secondColor = UIColor(red: 0.4, green: 1.0, blue: 0.8, alpha: 1.0)
100+
gradientView.angleº = 185.0
101+
gradientView.colorRatio = 0.5
102+
gradientView.fadeIntensity = 1
103+
gradientView.isBlur = true
104+
gradientView.blurOpacity = 0.5
105+
106+
view.insertSubview(gradientView, at: 0)
107+
```
108+
109+
# To-do
110+
111+
* Allow more than two colors to create gradients.
112+
* It may crash if blur properties used in lower version than ios 8.
113+
* Use CoreGraphics blur to replace `UIVisualEffectView`.
114+
115+
# Thanks
116+
117+
* To [Sudeep Jaiswal](https://github.com/sudeepjaiswal) for motivating and special thanks for the documentation and ideas.
118+
119119
# License
120120

121-
`EZYGradientView` is available under the MIT license. See the LICENSE file for more info.
121+
`EZYGradientView` is available under the MIT license. See the LICENSE file for more info.

0 commit comments

Comments
 (0)