Dealing with layer-backed IKImageBrowserView, Z-ordering and other concerns
Asked Answered
S

1

6

I am working on a project that needs to:

  • have a transition animation from a view that contains an IKImageBrowserView to another view;
  • have a hover overlay on each IKImageBrowserCell as the mouse moves across the view; and
  • have an NSView overlap a portion of the image browser view

The issues I am having are the following:

  • The IKImageBrowserView does not respect the z-ordering if it is not layer-backed --> the IKImageBrowserView stays on top regardless even if a view is on top of it (or in it for that matter)
  • If the image browser view is layer-backed, the z-ordering issue gets resolved but the custom-behaviour in the IKImageBrowserView breaks (e.g. hovers) --> In Mac 10.7 for example, the selection layer and the foreground layer of the browser cell don't move with the image in the "bounce" zone of the scroll view.

I need layer-backing to do the transition animations.

For performance reasons, I am aware that Apple does not advise sibling views overlapping. There are instances though that this cannot be avoided.

I have submitted a technical support incident to Apple about this. They have escalated it to the engineers but they also advised me to submit a bug report.

Has anyone has run into this before and if so what workaround did you employ?


For anyone who's curious, the sample project is here https://github.com/jdbenito/nerdery. In the app delegate, try commenting/uncommenting the -setWantsLayer: line.

The IKImageBrowserView start to exhibit weird behaviours when it is layer-backed. And the symptoms differ depending on the OS (e.g. In Mac OS 10.6, the hovers work until you switch to another tab and return back to the IKImageBrowserView. In Mac OS 10.8, the hover layers can't seem to render in the correct cell).

Standridge answered 9/11, 2012 at 2:9 Comment(2)
We're having the same problem. No solution found yet. Any news from your side?Dauphine
I had an unpleasant experience with IKImageBrowserView and will never try to use it again. Spending weeks for customizing it ended up with understanding that some simple things are just impossible to implement. So I created my own layer-hosted control in 3 days and now can modify it to fit my any need.Hollander
T
0

NSView siblings are definitely allowed to overlap. I had the same question a while ago and got confirmation from some Apple engineers: Are layer-backed NSView siblings allowed to overlap?

About the IKImageBrowserView: I'm under the impression that it is more or less intended to be used as a "black box", much like a UITableView on iOS: you can customize the cells and some behaviors, but you better not mess with its internal view hierarchy by adding subviews directly to it. If you need anything besides the standard, documented behavior, you might be better off writing your own solution. It shouldn't be overwhelmingly hard to do, especially because you have access to Image I/O for all your thumbnail and preview needs: https://developer.apple.com/library/mac/documentation/graphicsimaging/Conceptual/ImageIOGuide/imageio_source/ikpg_source.html#//apple_ref/doc/uid/TP40005462-CH218-SW3

Hope this helps!

Triennium answered 17/10, 2013 at 15:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.