sekhar
sekhar

Reputation: 263

Problem with drawing circle in Objective-C

I am trying to draw a circle using the following code.

 -(void)drawRect
{
  CGContextRef contextRef = UIGraphicsGetCurrentContext();
  CGContextSetRGBFillColor(contextRef,1,0,0,1);
  CGContextFillEllipseInRect(contextRef, self.frame);

}

I am getting my circle as expected, but at the edges of the circle truncated/interrupted. How can I solve this problem?

Upvotes: 0

Views: 987

Answers (1)

oddi
oddi

Reputation: 387

Try using self.bounds instead of self.frame. What class are you subclassing? Maybe you have to use self.view.bounds or self.view.frame ?

Upvotes: 1

Related Questions