Drawing with Core Graphics looks chunky on Retina display
I have a UIView that draws a circle from inside drawRect:rect. After reading the Apple dev info on the Retina display, it seemed like using Core Graphics meant that the drawings would automatically take advantage of the higher res. This simple circle, however, looks pretty chunky as compared to a similar circle in a badge icon. Obviously I’m comparing it to something that has gloss and shadow but I think it’s pretty obvious that mine is not being drawn as well. I tried taking screenshots of apple’s icon badge and my circle and they look about the same on my mac – the difference is obvious when looking at each on the phone, though. Is there something simple I’m missing here?
This is the drawing code that I’m using in drawRect:rect
UIBezierPath* aPath = [UIBezierPath bezierPathWithOvalInRect: CGRectMake(0, 0, 22, 22)]; [[UIColor whiteColor] setStroke]; [[UIColor redColor] setFill]; CGContextRef aRef = UIGraphicsGetCurrentContext(); CGContextTranslateCTM(aRef, 10, 10); aPath.lineWidth = 3; [aPath fill]; [aPath stroke];
Thanks for any help,
- In this CGBitmapContextCreate, why is bytesPerRow 0?
- iOS 7 style Blur view
- Creating UIImage from NSData created from buffer returns nil?
- How do I add a gradient to the text of a UILabel, but not the background?
- How can you apply distortions to a UIImage using OpenGL ES?
- Flatten CALayer sublayers into one layer
Solutions Collect From Internet About “Drawing with Core Graphics looks chunky on Retina display”
Oops, it needed antialiasing first:
CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetShouldAntialias(context, YES);
I added this before drawing, then set it to NO and drew another circle immediately afterward. The two circles, side by side, show that this was the problem.
- My navigation bar is showing up in storyboard but not in the simulator
- What is common data migration strategy for Core Data in iOS development?
- xcode 6 beta 4 – MessageComposeResult is not convertible to OptionalNilComparisonType
- Error in accessing google reader's Endpoints API
- Code Sign Error in macOS High Sierra Xcode – resource fork, Finder information, or similar detritus not allowed
- How do I use SwiftyJSON in my iOS App?
- How to get IPhone's Public IP Address without using a third party url
- I need to show my App in UIActivityViewController for All Applications as Action Extension(Default)
- Setting up VTK 6.1 in XCode 7.0.1
- understanding Xcode debugger var display
- Reachability not working when wi-fi connected but no internet
- Detailed instruction on use of NSOpenPanel
- Display ABPeoplePickerNavigationController using storyboard segue
- List/Search all existing UTIs (Uniform Type Identifiers)
- Firebase Analytics with iOS framework development project