The Old Blog Archive, 2005-2009

Cover-Flowize Your Application

People on the cocoa-dev mailing list talked about the cover flow API, which does exist, albeit not in public. If you know how to use IKImageBrwoserView, you already know how to cover-flowize your application.

In your Interface Builder project, drop in a custom view and make its class IKImageFlowView. In the data source class (which has the same form as IKImageBrowserDataSource), implement these two required methods:

  • - (NSUInteger)numberOfItemsInImageFlow:(id)aFlowLayer
  • - (id)imageFlow:(id)aFlowLayer itemAtIndex:(int)index

And there you have it:

Cover Flow Study

I showed that in yesterday’s CocoaHeads Taipei meet-up. The sample code is available here.

As this is an undocumented class, so caveat programmor. It may change in the next version’s OS X or simply be snapped away under your nose.

4 Responses to “Cover-Flowize Your Application”

  1. on 12 Nov 2007 at 5:50 pmtransient proofreader

    IKImageBrwoserView → IKImageBrowserView

  2. on 10 Feb 2008 at 6:39 amDaniel

    Hi.
    Indeed this works easily – my DVDs images are now viewed with cover flow :)
    Any idea about delegate methods and/or available bindings (exposedBindings only gives hiden and tooltip :( …)?
    specifically being notified of selection change…

    thanks
    Daniel

  3. on 10 Feb 2008 at 7:53 amDaniel

    “selectedIndex” is an observable value which does that

  4. on 30 Mar 2009 at 2:30 amPhilippe49

    Thanks for your work.

    I have a problem while updating the data source of an IKImageFlowView.
    - I use reloadData,
    - the IKImageFlowView requires data for all indices via – (id) imageFlow:(id)aFlowLayer itemAtIndex:(int)index

    but
    • previous imageItems do not disappear,
    • new imageItems are added only for new indices > previous indices .

    Philippe