Using Drag and Drop with NSTableView

Nate Thompson compiled a tutorial on how to implement drag & drop in NSTableView. It's a good read.

I remember how weird it felt to implement this the first time. Drag & drop is actually realized via the pasteboard. So it's more like cut and paste with a visual representation. From this you get the ability to put multiple content representations into the pasteboard at once, so the drop container can decide how to handle whatever it receives.

Drawing Custom Alternating Row Backgrounds in NSTableViews with Swift

This is an old hat in Cocoa: when you change the appearance of NSTableRowViews, they will indeed look different – but the enclosing table view itself will still draw the system default background to fill the space below the last row. Similarly, when you have scrolling elasticity enabled and scroll above the topmost row, whatever is being drawn there won't match your custom styled rows, either.

Continue reading …

Transparent NSTableView Headers

Teaser image

An NSTableView is usually embedded in a NSScrollView. If you set the columns not to span the full width, the two of them will take care of drawing an empty table header cell to the right so that the interface doesn't look weird. But I want to have a weird interface. Because TableFlip's tables are different than the usual NTableView use cases.

Continue reading …