A simple example of AFOpenFlow an open source Cover Flow alternative

Tagged:  

Cover Flow is a technique that lets you browse and select album covers. Its used by iTunes and on the iPhone iPod player when the device is held horizontally.

It a gorgeous, visual and tactile technique that can have applicability in many places. Unfortunately, it is not part of the public SDK and can not be used without using private methods that are not allowed.

Luckily there are open source alternatives such as AFOpenFlow by Alex Fajkowsky which are allowed. For more information on OpenFlow check out his blog and the source code is available at GitHub.

OpenFlow does have a sample program and I suggest you study it to see how OpenFlow should be used. The sample can be get images three different ways.

  1. embedded images loaded all at once
  2. operation queue to load images asynchronously
  3. operation queue to load from Flickr.

In order to demonstrate the simplest possible example I've created a stripped down version of the 'load all at once' sample.

All of the interesting code is in the SimpleOpenFlowViewController. There is an AFOpenFlowView iVar declared which is set up in SimpleOpenflowViewController.xib file.

Then in the controllers viewDidLoad method all we need to do set the number of images and then add each image to the view.

You will eventually want to use the operation queue methods to keep memory usage down and maintain responsiveness but this is all you need to do to get this slick interface with a small number of images.

I have not included the OpenFlow source in this project so to get it to compile download it from GitHub and add the missing files to the Classes/OpenFlow directory.

I hope this simple sample project gets you started and you look at implementing the datasource protocol in your real apps with many images.

AttachmentSize
SimpleOpenFlow.zip1.16 MB

Do you have an example that uses the operation queue? This is really cool code but completely undocumented.

Thanks.
D

Thank you very much, it works fine for me !
I have now to add a label, a name to each picture, and more I want to open a different video when I touch each picture.
I'm working on but if you know how to do that this will be really help full for me !
Thank you very much again !

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h2> <img> <p>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options