NSTableView setup to automatically resize middle column? - cocoa

Is it possible to set up a NSTableView with e.g. 4 columns in IB to allow just one column to resize when the table grows?
So far I couldn't achieve this with neither Resizing: Autoresizes or decreasing content hugging value for the TableCellView in the column that should be the only one that grows when the table is resized.
Is there any way to convince a particular column - not just the last one - to just 'let go' and resize with its NSTableView..?

In the xib, go to each column object and in the column object's attribute inspector set resizing to: None. Set resizing on the column you want to 'let go' to: Autoresizes with Table.

Related

View based NSTableView and row heights

I'm beginning to try and build an OSX app.
I'm using NSTableView with it set as view-based, however I want the rows to wrap properly (so all of the text in each is shown at once) however I can't seem to find out how do to this.
Using the rowHeight delegate method seems to point to cell-based NSTableViews so I don't know if I'm doing that right or not.
First select NSTableView and then Size Inspector and set row height:
and then select table cell view's which you want change:
And if you want then you can move or resize your table view cell if you want.

UITableView default row height Xcode

I want to program a table view, but there's a problem.
If I set one or more Cells the height of the rows is correct, but when the table view contains no cells, the height of the rows is too low. How can I change the default row height?
By using:
self.tableView.rowHeight = 80.0;
you should be able to set the row height, even when the table is empty.
Using
tableView:heightForRowAtIndexPath:
would not work in this case as it is only called when there is content to put into the Row.

UITableViewCell: Custom Row Height for prototype cell

In my storyboard file I am designing multiple prototype cells in a UITableView. Each cell has its own unique Cell Identifier.
Depending on the section and the row I dequeue one of the prototype cells in method - tableView:cellForRowAtIndexPath:
For most of the prototype cells I have not changed the Row Height. On my storyboard, their height seems to be determined by the property 'Row Height' under 'Size Inspector' of UITableView.
For one prototype cell I have changed the height through the property 'Row Height' under 'Size Inspector' of the specific UITableViewCell. The checkbox 'Custom' is also checked.
On my storyboard this seem to work well. But during runtime when my cells are being dequeued and added to the TableView, all cells get the default row height.
Now, I am aware of the method tableView:heightForRowAtIndexPath: which is being mentioned in other posts but it seems a little odd to use as I am setting a custom row height in my storyboard already.
Does somebody know why this property is not working? Is this property maybe mend to be used in different situations?
Thanks
If you want to use Interface Builder in Xcode 5 to change the height of the rows in a table view without code you can do it in two places:
Select the table view, show the Size inspector and type it in
Row Height, in the Table View Size section.
Select the prototype cell, show the Size inspector, check Custom in the Table View Size section and type the row height in the associate text field.
Could it be that you're using the second method? Try to use the first method to set the default height of all the rows in the table view and the second to tell Interface Builder about the exceptions.
heightForRowAtIndexPath is called (for each row of the table) before the cells are displayed, i.e. before cellForRowAtIndexPath is called. That is necessary to compute the layout of the underlying scrollview, the scroll indicators etc.

Nscell Size Not Increasing With Row Height During Text Edit

My NSTableView has variable height rows. The rows correctly resize after an edit of a cell has been completed, and during/after resizing the column/table. The Row also correctly resizes while a user is typing into the text cell.
However, the cell itself does NOT resize during editing to match the height of the row. Does anyone have any ideas on this? In this screenshot one end-edit has occurred already (which is why the text area is larger than 1 line) but there is currently enough text in the cell to account for about 5 lines, thus the height of the row is not matching what should be displayed.
Both the textview and the cell have to have their autoresize set if you want them to automatically scale.
It looks like the cells in the Tag Name column are properly set to resize but that either the cell or the textview in the value column has not been. Check the sittings in Interface Builder.

How do I tell NSTableView not to resize all other columns when showing/hiding a column?

I have an NSTableView, and I have the ability for the user to show or hide columns dynamically (with a mail-style header context menu).
My issue is that if the table view is currently wider than it's scroll view (i.e. it's displaying a horizontal scroll bar) when a column is hidden or shown it resizes every single visible column such that they all fit on the screen again. How do I make it, well, not. I just want the hidden/shown column hidden/shown without any resizing of the other columns.
I tried setting the column resizing style to None is interface builder, but that didn't have any effect.
You can do this by selecting each column individually in IB and disabling the Attributes->Resizes With Table checkbox.

Resources