Liscio and dcj were having a conversation on the #macsb IRC channel last week about designing better reusability between model, view, and controller components. That, of course, got me thinking about Mugshot, and that many of the pieces I wrote early on know way too much about the internals of the other pieces.
The main thumbnail photo view, for example, maintains references both to my app delegate and to the NSArrayController that contains the currently-selected photo information. But it didn’t really need to know that information. I decided to update the design a bit, and I’m happy to announce that I’m almost done with MUPhotoView.
MUPhotoView provides much of the functionality that you’d see in iPhoto:
- Resizable thumbnails
- Choice of borders (shadow, one-pixel gray line, or both)
- Choice of background colors
- Choice of styles for displaying selected photos. (This is actually more flexible than iPhoto, which always draws a blue highlight rectangle.)
- The border selection styles correctly choose your system-wide selection color.
- The “shadow box” selection style (similar to Pixadex) is also smart enough to adjust itself based on the background color.
- Drag out of the view. (Probably won’t have drop support yet).
MUPhotoView supports bindings for it’s photos and selection indexes but will switch to delegate methods if the bindings aren’t set. It also implements drag support using the delegate. It should be fairly easy to drop it into a new or existing app.
You can download the test app here.
I still need to update all of the keyboard navigation and finish all of the documentation. If I have time in the next few days, I will try to implement a few performance enhancements as well.
Very nice! I think I’m going to have to create an app that can use it now.
Yeah that’s the big question? Will we all benefit from your hard work or not? Looks great so far…
Ah, I guess I didn’t specifically mention this, but yes, I’m definitely going to post the source code here when I’m done with it
are you ready to release the source code yet?
hey dale,
I had a few things come up in the past week so I haven’t had much time to work on it. I’ve added some of the keyboard selection stuff, and set it up to recenter during photo resize. A few more things to go, though…
Is it possible to bind this with coredata?
Definitely. Although you will probably want a controller or something in between your data store and the view.