UITableView default row height Xcode - 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.

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.

How to Expand NSTableCellView Width When Resizing Column in NSTableView

I am trying to display a path in my table view. Both columns of the table view on the left side are the same for testing/demonstration purposes. Notice how the leftmost path is truncated:
When I expand the column, the (truncated) table view cell doesn't expand with the column:
My question is how would I go about resizing the cell when I resize the table view column?
Found a solution, what you want to do is add a few constraints
Step 1:
go to the table cell view for said column
Step 2:
Change these constraints
Step 3:
Change these constraints aswell
Step 4: run your app and look at your nice table :-D

NSTableView setup to automatically resize middle column?

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.

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.

Resources