1 DrawRect
2
3 - (void)drawRect:(CGRect)rect
4
5 {
6
7 // Drawing code
8
9 // 当前视图绘制信息
10
11 CGContextRef context = UIGraphicsGetCurrentContext();
12
13 // 设置线条的宽度
14
15 CGContextSetLineWidth(context, 5);
16
17 // 设置线条的颜色
18
19 CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
20
21 // // 设置线的起点
22
23 // CGContextMoveToPoint(context, 0, 0);
24
25 // // 设置一条直线(规定线的终点)
26
27 // CGContextAddLineToPoint(context, 280, 280);
28
29 // // 设置正方形
30
31 // CGContextAddRect(context, CGRectMake(20, 20, 240, 240));
32
33 // // 根据绘制信息 在视图上绘制图形
34
35 // CGContextStrokePath(context);
36
37
38
39 for (int i = 0; i < self.lineArray.count; i++) {
40
41 NSMutableArray *points = [self. lineArray objectAtIndex:i];
42
43 if (0 == points.count) {
44
45 continue;
46
47 }
48
49 for (int j = 0; j < points.count - 1; j++) {
50
51 NSValue *pointValueA = [points objectAtIndex:j];
52
53 NSValue *pointValueB = [points objectAtIndex:j + 1];
54
55
56
57 CGPoint pointA = [pointValueA CGPointValue];
58
59 CGPoint pointB = [pointValueB CGPointValue];
60
61
62
63 CGContextMoveToPoint(context, pointA.x, pointA.y);
64
65 CGContextAddLineToPoint(context, pointB.x, pointB.y);
66
67 }
68
69 }
70
71 CGContextStrokePath(context);
72
73 }
有人说:爱上一座城,是因为城里住着某个人,能够与所爱的人在一起,连光阴都是美的。即便粗茶淡饭,修篱种田,只要有你陪伴就好。那么,找一个青山绿水的地方,寻一处幽静的茅舍,或是云水禅心的庭院,那里有晴朗的阳光和静谧的悠然,还有你明媚的笑脸。掬一捧花香在平淡的日子,握着一路相随的暖意,让爱的馨香在柴米油盐中升腾;在一杯茶的温情里,体味生活的诗意;在一碗粥的清淡中,感受生活的浪漫,每天清晨你和阳光都在,便是我的幸福。——春暖花开 《择一城终老,遇一人白首》