Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

McBgnr

macrumors regular
Original poster
Apr 13, 2009
144
0
Hello,

I have a NSTableView which has 2 columns. First columns contains strings. Some of these strings are long and are not visible completely in the column. I have also added HorizontalScroll bar to the TableView but no use. It scrolls the contents of the TableView but not of the column.

How can I request TableColumn to resize so that the longest string is the column is completely visible. The min and max width parameters of the TableColumn are set correctly. I have also tried using the Col. Sizing style but it did not help either. Any suggestions?
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
I don't think there's a built-in way to do this, if I'm understanding it correctly. You could just use NSAttributedString to get the width of the string at the font (via the tablecolumn's datacell) and then set the column's width to that (plus a bit more probably for spacing).
 

McBgnr

macrumors regular
Original poster
Apr 13, 2009
144
0
I was wondering that there might be some built in way for this :-(. I will give a try to the other method using the attributed string.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.