1. Color space with gradient effect
First: Customize a gradient view, overriding drawrect in custom views
#import "ViewController.h" #import "MyView.h" @interface Viewcontroller () @end @implementation viewcontroller-(void) viewdidload{ [Super Viewdidload]; MyView *view = [[MyView alloc] initWithFrame:self.view.bounds]; [Self.view Addsubview:view];}
The next major 5 steps
- Get context
- Instantiate a color space
- Describe gradients
- Render context (Draw gradient)
- Releasing objects
2. Gradient effect, linear gradient
Step or the same as above!
- Get context
- Instantiate a color space
- Describe gradients
- Render context (Draw gradient)
- Releasing objects
Clear Saup
Source: http://www.cnblogs.com/qingche/
This article is copyright to the author and the blog Park is shared, welcome reprint, but must retain this paragraph statement, and in the article page obvious location to give the original text connection.
Ios-calayer drawing, how to draw gradients