Howto create a grid like iTunes - objective-c

I trying to draw a grid like Apple does in iTunes. A grid of images with an expanding row between the rows when you click one of the items in the grid.
After some googling and searching Stackoverflow all I found was IKImageBrowserView and NSCollectionView. Both options didn't work for me as I could not fit an extra row between the rows of the grid.
As a last resort I'm thinking about using something like NSTableView with NSTableViewGroupCell as a expanding row. But it feels dirty to me. Anyone any experience with this? Need some help to get me in the right direction here.

Related

Extended NSTableView

I would like to make a table-view with expanding ability.
When you press a row, the row should expand to show options like delete, copy and so on.
I have found an example for iOS, but I didn't get it running on Mac OS X, because NSTableView and UITableView are very different.
http://www.cocoacontrols.com/platforms/ios/controls/kofiles
Has anyone another template?
Or maybe even get this example running on Mac OS X?
I don't have code to hand you but you can use a view-based NSTableView. Your prototype view can resize itself to include controls if it's selected. All that's a bit complex to condense into a reasonably brief answer but if you use a view-based table view and treat the prototype view like any other that would grow and show extra controls, then wire this behavior to the selection state, it should work.
Note: you will have to write some code for the expansion portion, to handle resizing it, showing the controls, and notifying the table view that one of its rows changed height. Lots of documentation and examples exist out there for each individual component of your problem. Post more specific questions as you run into roadblocks.

Use dockpanel to stretch all children equally

What i would like to do is create a dockpanel with 4buttons and have the buttons be equal size .
However when i do this now, it formats the first 3 Buttons to fill the Contents of the button and the last button fills the remaining space.
Is there a way to have a control that i can put 4 buttons into and make them equal size. I have already seen the problems with StackPanel and from reading i thought dockpanel would fix this for me.
I know i can use setup a grid to fix this, but i was trying to find another solution.
I don't know which grid you know how to use, but I found the easiest solution is to use a UniformGrid with 1 row. That should fill all the buttons equally.

NSTableView doesn't update after sorting via column header

I have an NSTableView bound to a core-data-backed NSArrayController by binding individual columns to arraycontroller.arrangedObjects.
I have the default out-of-the-box sorting working, but when I click one of the column headers to sort the table I have problems.
Basically the display of the table gets messed up: rows get duplicated, and the sort order is all over the place.
However, when I click on a row the TableView redraws and everything looks fine.
So, it looks like the sorting is working properly, but it is not being reflected in the display of the tableview until I click on a row.
Can anyone tell me why my tableview isn't updating properly when I sort?
I have Googled this extensively, looked in the docs, and tried everything I can think of in the code but can't work out what is happening.
Thanks
Darren.
The problem was very simple in the end.
For some reason I had ticked the "Core Animation" layer selector for the TableView, which was causing the display to be garbled.
When I cleared the tickbox everything started working properly.
Regards
Darren.

NSTableView drag items "count badge"

When you start dragging items in the table view in Mail or iTunes, you see this count badge neatly showing (in a red "starred" circle, or rounded rectangle if the count gets big enough) the number of dragged items. Is there a ready-made code somewhere available for me to do this? Because if it is, it could save me a whole lot of time writing the drawing code for this myself.
I'm pretty sure there isn't. However it should be pretty easy to create a custom one. It'll be some fiddling with coordinates to get it right but actually shouldn't be too much code.
Maybe google already has some usable image data...

How would you put an Image next to a text cell for only parent rows in an outline view?

I am looking to have an image next to a text cell for only the parent rows in my Outline View.
Like what they have in Xcode: alt text http://snapplr.com/snap/wsgp
. How would you do this or would you need a Custom Cell?
You'll need to create a custom cell for this. I've noticed you asking a few similar questions in the past, so if you haven't started down the road of custom cells yet this would be a good opportunity to do so. It's not too difficult to do, it will be helpful in understanding how cells work, and there are plenty of tutorials and sample code examples to go from. Here's one example, I'm sure you can find plenty of others through Google. There's even one in the Xcode sample projects, I believe under one of the NSOutlineView examples (or at least there was back around 10.3).