Quartz2D - 画柱状图
来源:互联网 发布:虚拟扫描仪软件 编辑:程序博客网 时间:2024/05/21 09:55
//// BarView.m#import "BarView.h"@implementation BarView- (void)drawRect:(CGRect)rect{ // 数据 NSArray *arr = @[@25,@25,@50]; //属性值 CGFloat x = 0; CGFloat y = 0; CGFloat w = 0; CGFloat h = 0; for (int i=0; i<arr.count; i++) { w = rect.size.width / (arr.count * 2 - 1); x = 2 * w * i; h = [arr[i] floatValue] / 100.0 * rect.size.height; y = rect.size.height - h; UIBezierPath *path = [UIBezierPath bezierPathWithRect:CGRectMake(x, y, w, h)]; [[self colorRandom] set]; [path fill]; }}/** * 随机一个颜色 */- (UIColor *)colorRandom{ CGFloat red = arc4random_uniform(256) / 255.0; CGFloat green = arc4random_uniform(256) / 255.0; CGFloat blue = arc4random_uniform(256) / 255.0; return [UIColor colorWithRed:red green:green blue:blue alpha:1.0];}@end
0 0
- Quartz2D - 画柱状图
- Quartz2D柱状图
- Quartz2D 之饼状图、柱状图、进度条
- iOS Quartz2D - 画矩形
- quartz2d
- Quartz2d
- Quartz2D
- Quartz2D
- Quartz2D
- Quartz2D
- Quartz2D
- Quartz2D
- Quartz2D
- Quartz2D
- QuartZ2D
- Quartz2D
- Quartz2D
- Quartz2D
- 为何要学习Java语言
- hdu4006 The kth great number(优先队列)
- BZOJ_P4415 [SHOI2013]发牌(线段树)
- 零碎知识点汇总
- 抓住每一次学习的机会
- Quartz2D - 画柱状图
- struts2学习笔记-------为action的属性注入值
- 【项目经验】EasyUI Tree
- 【ShawnZhang】带你看蓝桥杯——算法训练 最小乘积(基本型)
- [网络流24题][CODEVS1904]最小路径覆盖问题(最大流||匈牙利算法)
- 下拉页面静止,旋转圆扭刷新效果
- 基本排序算法总结(C/C++)
- InputStream与String,Byte之间互转
- 学习C++反汇编-菱形继承