On Oct 16, 2009, at 10:32 AM, Half Activist wrote:

I'm using a NSCollectionView to display a stack of items (a table) but since what's display is far too complex to be laid out programmatically I went for the NSCollectionView. And it's been all problems from the beginning.

Yes, depending on what you need from it, its convenience can be outweighed by its limitations.


First of all with setContent that never worked no matter what I did...it only works if I bind the content to an nsarraycontroller.

Okay ... what have you tried? Can't help if you don't say what you did.


Now, when I add a new item in this "table" i want to be able to scroll it to the displayed area of the view,

Can you rephrase this? The "displayed area of the view" is ambiguous, but generally the displayed area is displayed because the scroll vie is already scrolled to that area. :-)

Did you mean you want to scroll to the currently-selected (or newly- added) collection view item (or some UI element within that view item)?


Suppose I have N items and therefore N subviews in the NSCollectionView, after changing the array that now contains N + 1 items, the nscollectionview has after the update N + N + 1 subviews!
So, accessing subviews is not an option either.

I haven't heard of this problem but then again, I had dismissed NSCollectionView early on as not being up to the tasks for which I'd hoped it'd be useful, so my experience with it is limited.

Again, what did you try? How did you go about this? I find it odd that it doesn't scroll to the selection (if that's what you were doing), but I imagine if you ask the array controller for the *arranged* index of the object just inserted (whole other question - ask it if it's required), then ask the collection view for the - itemAtIndex:, you can ask that item for its -view, then use the scrolling methods as needed.


If anyone knows how to do fix these bugs, and how to disable the animation, i'd be really glad.

I don't think there's any (public API) way to disable the animation. Why do you want to do that?


I'm considering writing an homebrew nscollectionview.

Depending on your needs, this could be easier. If you only need one "column", it's *almost* trivial. Especially if, like NSCollectionView, the size of each view is the same.

If they can vary in vertical size, you can even use the same "prototype view" approach by caching at least the height of the items for the current view width, which lets you quickly size the whole view and work out the rect for the desired item (or the items for the desired rect). This can *greatly* improve performance for lots of irregularly-sized items.

Of course there is more than one way to approach this but building a basic one-column layout view like this is fairly simple. Even adding drag-and-drop to this isn't too difficult for a moderately-experienced Cocoa developer.

--
I.S.




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to