Cocoa : Multiline NSTextFieldCell in a NSOutlineView
I am developing a Cocoa application.
I have a NSOutlineView displaying custom cells ( cells inherits from NSTextFieldCell). The problem I am facing to is that the cell text is 开发者_StackOverflow中文版only displayed on one line... how can I have a multiline textField ???
Thanks for reading ;)
- Configure your table column's dataCell to wrap instead of scroll with -[NSCell setWraps:]
- Implement -[NSObject outlineView: heightOfRowByItem:] in your outline view delegate.
- Use -[NSCell cellSizeForBounds:] to find the height of the cell for a specific width. For cellSizeForBounds:, you can pass a really tall rectangle that's the width of your column, and it will return a smaller rectangle that is the right height for the text to fit in that width.
精彩评论