/ Published in: Objective C
mainimg is a UIImageView
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
- (void) drawLine:(CGPoint) pt { UIGraphicsBeginImageContext(mainimg.frame.size); [mainimg.image drawInRect:CGRectMake(0, 0, mainimg.frame.size.width, mainimg.frame.size.height)]; CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSetLineCap(ctx, kCGLineCapButt); CGContextSetLineWidth(ctx,2.0); CGContextSetRGBStrokeColor(ctx, 1.0, 0.0, 0.0, 1.0); CGContextBeginPath(ctx); CGContextAddEllipseInRect (ctx,CGRectMake(pt.x-2.0, pt.y-2.0, 4, 4)); CGContextSetFillColorWithColor(ctx, [UIColor redColor].CGColor); CGContextFillPath(ctx); CGContextStrokePath(ctx); mainimg.image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); }
URL: http://www.netfilter.com.br