Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView like NSTableView

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?

like image 705
user2272641 Avatar asked Jun 04 '13 00:06

user2272641


2 Answers

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!

like image 74
Michael Dautermann Avatar answered Sep 20 '22 23:09

Michael Dautermann


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.

like image 38
Philip Fung Avatar answered Sep 20 '22 23:09

Philip Fung