Posted By

peetj on 04/08/11


Tagged

Objective-c Drawing Quartz


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

wpellis
Tintenklecks
cnathan


Draw rectangle with blue border and fill the rectangular space with red


 / Published in: Objective C
 

URL: http://www.techotopia.com/index.php/An_iPhone_Graphics_Drawing_Tutorial_using_Quartz_2D#Drawing_a_Rectangle

  1. - (void)drawRect:(CGRect)rect {
  2.  
  3. CGContextRef context = UIGraphicsGetCurrentContext();
  4.  
  5. CGContextSetLineWidth(context, 2.0);
  6. CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor);
  7. CGRect rectangle = CGRectMake(60,170,200,80);
  8. CGContextAddRect(context, rectangle);
  9. CGContextStrokePath(context);
  10. CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);
  11. CGContextFillRect(context, rectangle);
  12. }

Report this snippet  

You need to login to post a comment.