Create an image Browser
Create an image Browser
- Subject: Create an image Browser
- From: email@hidden
- Date: Tue, 10 Feb 2004 09:22:06 -0800
Ciao Roberto:
//How can I create an Image Browser as iPhoto?
//It uses NSTableView?
That's a pretty-open ended question, but it's something I've been
working on for the last 2 weeks, so you're in luck...;-)
The simplest way is to use an NSTableView where each cell is an
NSImageCell. The advantage to this approach is that most of the work is
done for you (i.e. efficient mechanisms for managing a data source,
expansion/contraction of the grid, etc. etc.) If all you need to do is
simply display a grid of images, then this will work fine. The main
disadvantages are that you cannot select a single cell "out of the box"
(although there are people on the list who have written their own code
for doing so). Also it's not so easy to group together multiple
controls in each cell.
Another option is to us NSMatrix. In this case, you're responsible for
writing your own methods for managing the grid, but managing selection
of a single cell in the grid is easy. Like an NSTableView, each item in
the grid is usually a single NSCell subclass, not a mixture of controls
grouped together in a single view.
The third option is to create an NSView subclass where you take
responsibility for dividing up the grid and adding your own sub views.
The advantage here is that you can put any type of controls in each
subview. The disadvantage is that you have to do everything. E tanto
lavoro.
iPhoto uses its own custom view, and is obviously very fast, largely it
seems, due to some clever tricks with only displaying part of the
thumbnail data while scrolling, then waiting for the user to let go of
the mouse before the rest of the data is fetched and drawn. I invite
members of the iPhoto team to share their secrets with the list. ;-) ;-)
In any case, if you're working with large data sets, you have to think
about some approach for breaking the entire data set into batches to
keep performance high.
Hope this helps. If you'd like some code snippets, I'd be happy to
share with you. I've gotten lots of help from people on the list, and
so I'm always happy to "share the wealth'.
Take care,
John
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.