I have an NSView class that draws its contents on CALayer. These NSView classes are stored in an NSTableView, which has a single column. I need to make NSTableView adjust its size so that it matches the contents of the NSView it contains, which can have a variable width, i.e. NSTableView should have the same width as the widest cell. This, in turn, will allow the user to scroll if the width of the cells is greater than the available area.
Think of it as a multi-track audio editor, where each view is a track, but the tracks can have different lengths.
At the moment, NSView cells seem to automatically adjust the width of the table column, so I see two possibilities: one of them is to make the NSViews cells set their width and somehow distribute this publication everywhere, The other should have tableview or nstablecolumn set its width based on maximum width. I tried setting the width of NSTableColumn and minWidth, but this does not seem to work (it does not always adjust to the correct size if the size is large).
Any suggestions or help to make this work?
source
share