UITableView like NSTableView
Asked Answered
T

2

6

Ive developed for iOS in the past and recently moved over to mac development. I began a project to "get the feel" of things, and ran into an issue. Im trying to create a NSTableView to display multiple items, including a label, a 2 UIImageViews, and a UIButton. NSTableViews are way different than tables on iOS, and I cant simply create a custom TableViewCell (I think). A great example of how I would like it to look is AlienBlue for Mac: (The middle table with post information)

AlienBlue for Mac

Can anyone shed some light on how to create this?

Tenstrike answered 4/6, 2013 at 0:21 Comment(1)
I think the title of this post needs a hyphen: "UITableView-like NSTableView". Or "NSTableView like UITableView".Aviator
P
6

You have the power of being able to return whole views instead of cells in NSTableViews.

Here's Apple's documentation on View-based tables and how to populate those views in your table.

The delegate method I use most in my own view-based tables is "tableView:viewForTableColumn:row:"

Hopefully this points you in the right direction!

Posticous answered 4/6, 2013 at 0:37 Comment(2)
Unfortunately the links in the answer doesn't seem to be available now. :(Darkling
developer.apple.com/library/mac/documentation/Cocoa/Conceptual/…Stickseed
M
4

Please use NSCollectionView instead (set NSCollectionView.maxNumberOfColumns = 1). It's a more modern, extensible view api, that is analogous to UICollectionView.

In contrast, NSTableView was originally meant for displaying a spreadsheet table (with add-on support for custom view cells), and is less consistent with UITableView.

Musculature answered 5/4, 2017 at 19:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.