I am developing a template blocking application (e.g. Android lock).
I want to draw lines between the points to open the lock, but when I draw, it returns an error:
<Error>: CGContextAddLineToPoint: no current point
It works fine in iOS 5.0 and earlier, but shows an error in 5.1.
This is my code:
- (void)drawRect:(CGRect)rect { NSLog(@"drawrect...%@",NSStringFromCGRect(rect)); if (!self._trackPointValue) return; CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 10.0); CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); CGFloat components[] = {0.5, 1.0, 0.5, 0.8}; CGColorRef color = CGColorCreate(colorspace, components); CGContextSetStrokeColorWithColor(context, color); CGPoint from; UIView *lastDot; for (UIView *dotView in self._dotViews) {
Pardhu
source share