• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
iPhoto-like image view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iPhoto-like image view


  • Subject: iPhoto-like image view
  • From: email@hidden
  • Date: Wed, 28 Sep 2005 10:41:27 -0700

I'm creating an app to interact with Flickr's web services and want to create a view that acts similar to iPhoto's image view (and in some ways, like Delicious Library's main view) - it shows a list of photos, allows selection of individual photos, or drag-select to select multiple. Does anybody have any tips for how best to go about this?

First, I tried simply subclassing NSView. I implemented my own drawRect to paint the pictures. It was fairly painless, and even added more columns full of photos as the view grew and shrank with the window. It looked exactly how I wanted it to, but I figured there would be a lot of work to implement selection, drag-selection, etc. I was also doing a lot of calculations to determine how high my view should be based on the current width, and also calculating the inter- photo spacing, etc. Instead of trying to implement all that, I also tried a couple version with NSMatrix...

http://www.blakeseely.com/files/PhotoMatrix-CustomView.jpg

Next I tried adding an NSMatrix full of NSImageCells as a subview to my custom view. Having it as a subview to my custom view allowed me to make sure I blanked out the backgrond when the matrix shrank. Trying to match the size of the NSMatrix with my custom view (it's superview) was difficult, and there were often visual glitches here. It seemed like having the NSMatrix as a subview was an unnecessary layer...

So lastly, I tried just making my custom view a subclass of NSMatrix. For the most part, this works exactly as I'd like except for two problems. The initial redraw doesn't happen until I start resizing the window. I'm not sure why this is, but I know my custom drawRect got called, but the images don't actually appear until I start manipulating the window. Also, when the NSMatrix shrinks, it doesn't repaint/clear the cells that no longer exist - so their remnants still display in the view. I'm still trying a few things to get this working.

I am going to try and grab a few screenshots/movies of the various behaviors, but does anybody have tips/tricks/experiences for how best to do this? Anybody done something similar before?

Thanks,
Blake
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: iPhoto-like image view
      • From: Lee Morgan <email@hidden>
  • Prev by Date: WebView and TabView
  • Next by Date: Re: iPhoto-like image view
  • Previous by thread: Re: WebView and TabView
  • Next by thread: Re: iPhoto-like image view
  • Index(es):
    • Date
    • Thread