NSTableCellView padding
Below are some options for getting the padding.
Earlier I had some problems getting the correct bounding box height for NSAttributedString
. I don't remember how I solved them but there are some discussions on the matter.
Idea #1:
Use NSTableView's intercell spacing. It's also available in the Interface Builder from the table view's size tab. Look for cell spacing.
Idea #2:
When editing the interface:
- Unless you need something else, use the text or image and text table cell view provided by Apple.
- Change the height of the table cell view inside the table view using the size tab.
- Reposition the text field inside the table cell view.
Idea #3:
Use a custom cell.
- You can change the field editor position by overriding
-[NSTextFieldCell editWithFrame:inView:editor:delegate:event:]
. There's also-[NSTextFieldCell setUpFieldEditorAttributes]
. I foundthis sample codeuseful. - If you increase the height of the cell, there are a couple of ways to make
NSTextFieldCell
draw the text vertically centered.