Monday, March 4, 2013

Mac Retina Supported Toolbars with Real Studio (Xojo)


Supporting retina base graphics in mac apps is easy. However how would one support retina graphics in an Mac Toolbar. With Retina we know we need to make all graphic files 2 times bigger than the standard resolution image. The standard resolution images files for toolbars are 32x32 pixels so high resolution needs 64x64 pixel images loaded.

Start by using toolbar icons that are 64x64 pixels and label them with an 2x suffix. Then make or use 32x32 pixel toolbar icon images for the standard resolution images. Once you have both an 2x and standard resolution icons for each toolbutton you want to add, import those into your project.

You will also need to build for Cocoa as Carbon based windows do not support high resolution displays at all.

To do this you will need to create the toolbar by code. As of the latest release 2012 r2.1 there no built in way to do this other than by code.


-

Also note that your application will also need to add the following plist setting or it will not work.

<key>NSHighResolutionCapable</key>
<true/>

If your not on an Retina based mac, you can still test your app for retina by downloading Xcode and installing the graphic add-on package. What you need is the Quartz Debugger developer tool application. Using it allows you to test for Retina based resolutions.

The code used in this video can also be used with all other image files within an retina supported app. Such as menu icons, list box icons, segmental icons and the such. Also I have examples of using pdf vector based files with segmental controls where those files alone support retina because they are using vector based images.

All the other system controls and text are fixed by simply adding the property list key:

<key>NSHighResolutionCapable</key>
<true/>

Only Images  bitmap images require the method shown in the video.

Cheers, and happy coding.

No comments:

Post a Comment