// // IfishChatView.m // Ifish // // Created by 罗艺 on 2018/8/27. // Copyright © 2018年 lianlian. All rights reserved. // #import "IfishChatView.h" @interface IfishChatView() @property(nonatomic,strong)NSMutableArray*line1; @property(nonatomic,strong)NSMutableArray*line2; @end @implementation IfishChatView -(NSArray *)line1{ if (_line1==nil) { _line1=[NSMutableArray array]; for (int i=0; i<50; i++) { CGFloat x=10*(i+1); CGPoint p1=CGPointMake(x, x); [_line1 addObject:NSStringFromCGPoint(p1)]; } } return _line1; } -(NSArray *)line2{ if (_line2==nil) { _line2=[NSMutableArray array]; for (int i=0; i<50; i++) { CGFloat x=10*(i+1); CGFloat y=sin(x)*10+5; CGPoint p1=CGPointMake(x, y); [_line2 addObject:NSStringFromCGPoint(p1)]; } } return _line2; } // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { UIColor *color = [UIColor redColor]; [color set]; //设置线条颜色 UIBezierPath* path = [UIBezierPath bezierPath]; path.lineWidth = 1.0; path.lineCapStyle = kCGLineCapRound; //线条拐角 path.lineJoinStyle = kCGLineJoinRound; //终点处理 [path moveToPoint:CGPointMake(0.0, 0.0)];//起点 // Draw the lines for (int i=0; i