i want to draw a line in the rect of UIView when i touch screen. please can someone help me to check the code ! thanks
- (void)drawRect:(CGRect)rect {
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 5.0);
CGContextSetStrokeColorWithColor(context, [UIColor greenColor].CGColor);
CGContextSetFillColorWithColor(context, [UIColor greenColor].CGColor);
CGContextMoveToPoint(context, 100.0, 30.0);
CGContextAddLineToPoint(context, 200.0, 30.0);
CGContextStrokePath(context);
}
thanks.