Why does my CGContext-drawn circle suck?

I have a custom table view cell that is intended to draw a circle like the iPhone’s Mail.app does:

Instead, it draws like this:

Here’s my code:

CGContextRef context = UIGraphicsGetCurrentContext();
UIColor *grayColor = [UIColor grayColor];

[grayColor set];

CGContextStrokeEllipseInRect(context, CGRectMake(9, 10, 23, 23));

How can I make it not suck? :)

Edit: Ignore the fact that I omitted the code that draws the white background color.

What about it sucks? It doesn’t look close to, if not exactly like, the circle from Mail.

Answers


I was able to solve this by changing the UIColor to the same color Apple uses, #E5E5E5:

[UIColor colorWithRed: 0.8980392157 green: 0.8980392157 blue: 0.8980392157 alpha: 1.0]

And changing the line width from the default 1.0 to 2.0:

CGContextSetLineWidth(context, 2.0);

Tweaking the size was also necessary:

CGContextStrokeEllipseInRect(context, CGRectMake(10, 11, 21, 21));

The final code looks like this:

CGContextRef context = UIGraphicsGetCurrentContext();
UIColor *grayColor = [UIColor colorWithRed: 0.8980392157 green: 0.8980392157 blue: 0.8980392157 alpha: 1.0];

[grayColor set];

CGContextSetLineWidth(context, 2.0);
CGContextStrokeEllipseInRect(context, CGRectMake(10, 11, 21, 21));

And outputs like this:


Need Your Help

How to put image “placemarkers” inside a scrollbar in WPF?

wpf image scrollbar scrollviewer

I have a long Scroll Viewer and I want to mark important spots with small images on the scroll bar. If the the image is clicked the scroll bar will jump to the corresponding content.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.