2

Hi in my application i have to draw a circle on view. For that i used below code

CGContextRef contextRef = UIGraphicsGetCurrentContext();
        CGContextSetLineWidth(contextRef, 2.0);
        CGContextSetRGBStrokeColor(contextRef,red,green,blue, 1.0);

        CGRect circlePoint = (CGRectMake(rect.origin.x,rect.origin.y,rect.size.width,rect.size.height));

        CGContextStrokeEllipseInRect(contextRef, circlePoint);

i am getting the circle also but i am getting the circle in this manner if you observer the image the thickness of the line is not uniform but i need the circle with uniform line thickness

if any one have any idea please let me know. Thanks in advance please help.

Naresh
  • 363
  • 1
  • 18
  • Basically, you're drawing outside the context, so it is being clipped. A two pixel stroke is half outside the rect when it is drawn. – jrturton Mar 27 '13 at 07:22
  • Hi jrturton please help me, how to draw a circle indside the context inorder to avoid clipping.Thanks in advance. – Naresh Mar 27 '13 at 07:25
  • Did you follow the duplicate link? The answer is there, that's why I linked it. – jrturton Mar 27 '13 at 07:27
  • Hi thanks a lot. I found the place and issue is resolved. – Naresh Mar 27 '13 at 08:21
  • Hi one more doubt can we access these circle properties from someone else.I mean now i added circle on view successfully. Now i want to change the thickness of the line with button click means 2 to 4 and in the same way from 4 to 2 using another button is it possible. – Naresh Mar 27 '13 at 08:25

0 Answers0