How to make NSTableView column fit its content on resize? - macos

Im my app I have NSTableView (view based) and when I add the value that is too long to the last column
first it "hits" the scroller
then when I resize the window the row is not getting resized to fit the content
does anyone know how to deal with this problem?!
Any kind of help is highly appreciated!

The reason for this problem is due to constraints. If you are using NSTableCellView under NSTableColumn, then you need to set constraints for NSTableCellView. Highlight NSTableCellView and click on "Resolve Auto-layout issue" and click on "Add missing constraints in the container". This will fix the issue.

Related

Scroll view not scrolling in storyboard

I have the following scroll view although when I run the simulator I am not able to scroll. I have vertical constraints set for the content items, any idea why this is?
can you provide your constraint details? i hope you have added one view on top of the scrollview.

Xcode 7.1 - Prototype cells in storyboard not showing up

I just updated to Xcode 7.1 and I noticed that all of the prototype cells in my storyboard tableviews are showing as blank and their elements are missing. Sometimes I can see the prototype cells at the top of the tableview, but when I scroll down to view the others all the cells appear blank and white again.
Has anybody else experienced this and is there a quick fix?
Yes, I'm also experiencing this issue.
As a quick workaround, you can set the View Controller simulated size to Freeform, and make it big enough to accomodate all of your custom cells.
Select View Controller
Change its height
Changing it back to Fixed will revert it to the regular size.
Selecting the Table View and selecting the 'size inspector' icon in the 'utilities' pane and ticking the checkbox 'Preserve SuperView Margins' in the 'view' section seems to reset it.
preserve superview margins
However it's not fixing the problem, it worked fine in previous versions and I agree with #matt to file a bug report with Apple
Edited: Seems they fixed it in 7.1.1

XCode 6.1.1 UITableView White Spacing Gap

I have been running into some issues where my UITableView after being dragged and dropped into my view controller appears with a sizable white space gap from the top of the element ot the start of the prototype cells. Why does this occur by default and is there a way to remove this? Maybe in the size inspector?
I was having the same issue in 6.3.2 and all I had to do was to go to the ViewController's attribute inspector and uncheck the "Adjust Scroll View Insets" in the layout information section.
Sorry, they won't let me post images, but that solved the frustration for me. Hope it helps someone else.

Static UITableView not showing cells with subviews (UIButton, UISlider etc.) in Content View

I've run into a peculiar problem with Xcode. I have a custom UITableViewController that appears as a popover for a few settings in an iPad app. It's a static table view with just 3 cells in 2 sections. It looks fine in the Storyboard editor, but at runtime the cells with custom views (UILabels, UISlider, UIButton) do not show up at all, but those custom views do (in random places).
When I delete the custom elements from the cell or change the cell to anything but custom then they show up fine, even if the view (like basic for example) contains a label in its Content View. It's a lot clearer to see with the attached picture.
To solve this, I've created a completely empty cell below those with custom elements. It looks fine, but I can't interact with any elements. User Interaction is enabled for all elements, cells, and the entire table view. If you have any ideas how to solve that or how to get the cells working properly so I don't need the blank cell hack that'd be much appreciated!
I'm using Xcode 6 beta 7 on OS X Yosemite, programming in Swift.
Thanks in advance!
The question has been answered here Stack Overflow Setting up Auto Layout connections from the label to the Content View solves this issue.
It was a combination of the above link as well as this one that finally solved it.
I added the 4 constraints from each object (UIButton and UISlider) to all four sides of its cell's Content View (top, bottom, leading, trailing). Then, I had to check the "installed" checkbox for each constraint, which was not checked.
Thank you so much for your help, it's working great now!

Hover effect issue in NSTableView

I have a view based NSTableView in my application and I have added the hovering effect for the rows using the implementation in HoverTableDemo. I can get the hovering effect when the mouse is over a row without a problem , however when the tableview is scrolled down sometimes it leaves highlighting effect on the top cells when the table view is scrolled up again. I think this is due to NSTableView reuses the cell. I highlight the row by overriding the
- (void)drawBackgroundInRect:(NSRect)dirtyRect
method in NSTableRowView. Could someone point me to the right direction to solve this issue ?
Thanks in advance .
I think it is because the mouseExit event does not get called on scrolling and hence the background is not reset.

Resources