All you need to make the developers, it is properly configured to work with the regime HiDPI.
About the class NSImage.
All the work is not in pixels but in points. Released two QuartzCore used to work with all images or do a little fix-resize the output image.
Do not forget about the icon. This designer's work - painting the icons in the amount of 1024x1024px.
If the application is actively using OpenGL.
When initializing the NS*View is bound to 3D-context, do check the retina.
- #if (defined(MAC_OS_X_VERSION_10_7)) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
- if ( [ NSApplication usingLionOSX ] )
- {
- NSRect baseBounds = [ self bounds ];
- NSRect hdpiBounds = [ self convertRectToBacking : baseBounds ];
- if (NO == NSEqualSizes(baseBounds.size, hdpiBounds.size))
- {
- [ self setWantsBestResolutionOpenGLSurface : YES ];
- }
- }
- #endif
If you change the size of the application recalculate dimensions.
- - (void) updateBounds
- {
- NSRect baseBounds = [ self bounds ];
- #if (defined(MAC_OS_X_VERSION_10_7)) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
- if ( [ NSApplication usingLionOSX ] )
- {
- baseBounds = [ self convertRectToBacking : baseBounds ];
- }
- #endif
- ....
- glClearColor ( 0.0f, 0.0f, 0.0f, 1.0f );
- glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
- glViewport (0.0f, 0.0f, baseBounds.size.width, baseBounds.size.height );
- ....
- }
About the class NSImage.
All the work is not in pixels but in points. Released two QuartzCore used to work with all images or do a little fix-resize the output image.
- NSImageRep* rep = [[img representations] objectAtIndex:0]; // fix HDPI
- if (rep)
- {
- NSSize size = NSMakeSize ([rep pixelsWide], [rep pixelsHigh]);
- [img setSize : size];
- }
Resources and rewards.
All UI elements are presented in the form of bitmap images must be properly scaled up twice. XCode automatically to pick up, just add '* texture.name * @ 2x.tiff ' copy of your texture to the project. If you need to manually create bitmaps from the resource that is the method of [NSimage imageNamed: @ "* texture.name *"] correctly load the desired image.
Do not forget about the icon. This designer's work - painting the icons in the amount of 1024x1024px.