Frage

I have a IKImageBrowserView inside of a NSScrollView that is populated with a bunch of images. How do I add a background image that will scroll with the images in the IKImageBrowserView?

Basically what I am trying to do is create a view similar to the iBooks app on the iPhone with items sitting on a bookshelf.

War es hilfreich?

Lösung 2

I was able to achieve the effect I was looking for by implementing the custom ImageBrowserView and ImageBrowserBackgroundLayer classes from the sample project here: http://developer.apple.com/library/mac/#/legacy/mac/library/samplecode/ImageKitDemo/Introduction/Intro.html

What I did was move the custom ImageBrowserView and ImageBrowserBackgroundLayer classes to my project then set the browserView's background layer to the custom class like this:

ImageBrowserBackgroundLayer *backgroundLayer = [[ImageBrowserBackgroundLayer alloc] init];
[browserView setBackgroundLayer:backgroundLayer];
backgroundLayer.owner = browserView;

Then in interface builder I had to change the scroll view's View class to the custom ImageBrowserView class.

Andere Tipps

IKImageBrowserView has a background layer, which can be set with - (void) setBackgroundLayer:(CALayer*)aLayer. You can perform any drawing you want in this layer.

See Core Animation Layer Integration section in https://developer.apple.com/library/mac/#documentation/graphicsimaging/Reference/IKImageBrowserView/IKImageBrowserView_Reference.html

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top