Cutted text in NSTableView column - swift2

I'm playing a bit with NSTableView and CoreDate in Swift and all works almost ok but still can't fix an issue with cutted text in column's TableViewCell. It always shows ellipsis where text is loger than certain number of characters and I can't change it neither by setup in IB nor by changing column width and plaing with layout constraints.see attached screenshot
Any hint much appreciated, thanks.

Finally I found the solution and used code line below (cell is NSTableCellView)
cell.textField!.lineBreakMode = NSLineBreakMode.ByWordWrapping
plus addd constraints to cell text fields

Related

How can I make a UITextField with padding on the left of the content?

UITextField shows its content text bang against the left edge of the field, which is ugly and can be hard to read if the field has a visible border. UITextView, on the other hand, automatically has padding (blank space) around the text. I examined and experimented with all the UITextField properties but I don't see any way they can be used to get padding around the text.
I also tried calling drawText(in:CGRect) on the text field but it had no effect. But I'm not sure what CGRect is needed in that call. I tried different border styles including .none. I also tried making a blank UIView and assigning that to the text field's leftView property but that also had no effect. And I tried doing these things in viewDidLoad, viewDidAppear, and at the point where I'm writing the text into the textField. The text shows in the textField as expected but none of these other things seem to affect the textField's appearance in any way. It seems to me lots of people must show text in a UITextField and somehow get it padded on the left so I'm misunderstanding something but what???
The following works for a field called "textField". It inserts padding by shifting the left side of the field's content 8 pixels right relative to the left edge of the textField:
textField.layer.sublayerTransform = CATransform3DMakeTranslation(8, 0, 0);
This is given in an answer to a different question by user Dhiru (reputation 1285) in Nov. 2016. Thank you Dhiru!
I have to add that I am not familiar with either sublayerTransform or CATransform3DMakeTranslation so I can't be sure that this doesn't have some side effect that isn't immediately obvious. I'm a little worried that it's called "3D transform" whereas there is nothing 3D about my application. But at least for now this seems to answer the question.

Swift increasing the width of tableview cell.textlabel

I've tried adding a prototype cell and a label to it, among other approaches but can't seem to get there.
My table ends up displaying a couple of words followed by ... with most of the row empty.
Thanks!

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!

Cells don't resize when user resizes NSTableViews columns?

I have found that the text in a table view doesn't grow when the user resizes the column. (Or for that matter shrink if he shrinks the column, because the truncation ellipses then vanish.) Having gathered that this is something to do with constraints, my solution has been to uncheck Use Auto Layout (in the xib's file inspector). Not a big deal, but it comes just when I was beginning to think I might have mastered Autolayout.
Is that really the only way to do this?
The table is view-based, and gets its data from Core Data via an array controller. The text is displayed in an NSTextField.
It is as you have found out yourself.
If you want to know/learn more about NSTableview-behavior search for "TableViewVariableRowHeights" and "TableViewLinks" in Apples documentation and download the samples.
This question appears to be answered in:
How to Expand NSTableCellView Width When Resizing Column in NSTableView
summary: add horizontal constraints to the table view cell
see the link for screenshots

How to make NSTableView column fit its content on resize?

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.

Resources