Draw Over UIImageView


/ Published in: Objective C
Save to your folder(s)

mainimg is a UIImageView


Copy this code and paste it in your HTML
  1. - (void) drawLine:(CGPoint) pt {
  2.  
  3.  
  4. UIGraphicsBeginImageContext(mainimg.frame.size);
  5. [mainimg.image drawInRect:CGRectMake(0, 0, mainimg.frame.size.width, mainimg.frame.size.height)];
  6.  
  7. CGContextRef ctx = UIGraphicsGetCurrentContext();
  8. CGContextSetLineCap(ctx, kCGLineCapButt);
  9. CGContextSetLineWidth(ctx,2.0);
  10. CGContextSetRGBStrokeColor(ctx, 1.0, 0.0, 0.0, 1.0);
  11. CGContextBeginPath(ctx);
  12. CGContextAddEllipseInRect (ctx,CGRectMake(pt.x-2.0, pt.y-2.0, 4, 4));
  13. CGContextSetFillColorWithColor(ctx, [UIColor redColor].CGColor);
  14. CGContextFillPath(ctx);
  15.  
  16. CGContextStrokePath(ctx);
  17. mainimg.image = UIGraphicsGetImageFromCurrentImageContext();
  18. UIGraphicsEndImageContext();
  19. }

URL: http://www.netfilter.com.br

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.