渐变
来源:互联网 发布:php 代码加密 脚本之家 编辑:程序博客网 时间:2024/04/30 23:22
#import "MyView.h"
#define RGBCOLOR(r,g,b,a) [UIColor colorWithRed:(r)/0.0f green:(g)/0.0f blue:(b)/0.0f alpha:a]
@implementation MyView
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, 255, 255, 255, 1);
CGContextFillRect(context, CGRectMake(0, 0, self.frame.size.width, self.frame.size.height));
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGFloat alphaGradientLocations[] = {0, 1.0};
NSArray* alphaGridentColors = @[(id)RGBCOLOR(0, 0, 0, 0).CGColor,
(id)RGBCOLOR(0, 0, 0, 1).CGColor];
CGGradientRef alphaGradient = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)alphaGridentColors, alphaGradientLocations);
CGContextDrawLinearGradient(context, alphaGradient, CGPointZero, CGPointMake(0, self.frame.size.height), 0);
CGGradientRelease(alphaGradient);
CGColorSpaceRelease(colorSpace);
}
@end
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变
- 渐变:线性渐变、径向渐变
- css3渐变SVG渐变
- CSS3 渐变 线性渐变
- 渐变按钮、渐变边框
- CSS3-颜色渐变--线性渐变+径向渐变
- css3渐变、线性渐变和径向渐变
- ThreadLocal
- ecshop Notice: unserialize() includes\cls_session.php on line 163
- Linux下复制粘贴快捷键
- 1016. 部分A+B (15)
- Code Review (代码审查)
- 渐变
- Docker -- 命令总结
- 《云计算》学习笔记2——Google的云计算原理与应用(GFS和MapReduce)
- oracle日志备份恢复
- java exec shell cmd 用法
- 关于php中的addslashes
- 软件开发的核心技术
- 各种音视频编解码学习详解
- UITableView/表格视图