1

I want to have custom table cells in my table view, that contain a colored circle as seen in the calendar app of the iOS devices (the one where you select the displayed calendars).

Right now I made a custom cell that is having an UIView-sublass (called it CircleView), and the drawRect looks like this:

CGContextRef contextRef = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(contextRef, 0, 0, 255, 0.1);

CGContextFillEllipseInRect(contextRef, CGRectMake(10.0, 10.0, 10.0, 10.0));

This will basically draw a circle in the color I want and in the place I want. However I cant seem to find a way to make the border of the circle in dark, 1-point thick color, and the rest of the circle filled with a lighter color. Do I have to draw multiple circles and overlay them in a way?

Example of how it should look like: http://i56.tinypic.com/svrkmf.png

[edit] Managed to get a good looking solution with this code:

CGContextRef context= UIGraphicsGetCurrentContext();

CGContextSetFillColorWithColor(context, self.color);
CGContextSetAlpha(context, 0.5);
CGContextFillEllipseInRect(context, CGRectMake(10.0, 10.0, 10.0, 10.0));

CGContextSetStrokeColorWithColor(context, self.color);
CGContextStrokeEllipseInRect(context, CGRectMake(10.0, 10.0, 10.0, 10.0));
user944943
  • 113
  • 1
  • 2
  • 9

0 Answers0