(void)drawRect:(CGRect)rect
{
// Drawing code
CGContextRef context = UIGraphicsGetCurrentContext();
//白色
CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 0.85);
float width = self.righteyepointone.frame.size.width;
if (width == 0.0) {
width = 1;
}
CGContextSetLineWidth(context, width);// Draw a connected sequence of line segments
CGPoint addLines[] =
{
firstPoint,secondPoint,
};
CGContextAddLines(context, addLines, sizeof(addLines)/sizeof(addLines[0]));
CGContextStrokePath(context);
}
- (void)drawLine:(CGPoint)point nextPoint:(CGPoint)nextpoint
{
firstPoint = point;
secondPoint = nextpoint;
[self setNeedsDisplay];
}