IKImageBrowserView on Retina Screen

Has anyone successfully used IKImageBrowserView with a Retina Mac? I get that image size is wildly misinterpreted. I used to use CGImage images that do not have a logical size, so it makes sense that the browser cannot draw the desired size. However, I switched to NSImage created using -initWithCGImage:size: and this still does not work correctly.

My images are 244x184 pixels and should be drawn with a logical size of 122x92. When passing 122x92 in size, they are too large, about 180 pixels wide. If I go exactly half of this, 61x46, the size will be correct, but the image will be reduced, not sharp. If I go through 122x92 and start with NSHighResolutionCapable set to NO in Info.plist, everything works fine.

I came to the conclusion that IKImageBrowserView does not support Retina even with the 10.10 SDK on a Retina MacBook Pro running OS X 10.11. Or am I missing something? Any pointers would be appreciated!

+6
source share
1 answer

I found that I really do not think about the right way. It is assumed that the browser will always scale its images, so retina-sized images will increase. I just subclassed the browser to be able to use a custom cell and adjust the image frame per cell. However, there are some subtle bugs in the browser that force it to scale images in Retina mode a bit, but I was able to get around this by creating my own foreground layer for each cell containing the image without scaling. The problem is solved. Hope this helps someone else in the future.

0
source

All Articles