问题
I think I must be missing something simple but being new to Xcode... Specifically I am coding in Swift but I believe this is more of a .xib file question. It is easy to have add and delete buttons outside of an NSTableView (like the native Mail app's Preferences->Signatures panel) but how do you integrate these into what seems to be the NSTableView itself? (more like the native Mail app's Preferences->Accounts panel) Ideally I want the option to have more than just add / delete buttons present but once I understand the process adding more functionality should be easy.
回答1:
These buttons are not integrated, it's just an NSSegmentedControl
aligned to the bottom of the table view.
To get this particular appearance of the NSSegmentedControl
- Set
Style
toSmall Square
- Set
Mode
toMomentary
- Set the
Image
of Segment 0 toNSAddTemplate
- Set the
Image
of Segment 1 toNSRemoveTemplate
- Set the
width
of Segment 0 and 1 toAuto
- Set the
width
of Segment 2 to a fixed width.
回答2:
The particular example you showed is just some buttons in a container view abutting the bottom of the scroll view that contains the table view. The container view draws a background to match the buttons and a border. It's probably actually "underlapping" the scroll view by a point so you don't get a doubled border between them.
In fact, if you look carefully, the container view is one point too narrow, so that its right border doesn't match the right border of the scroll view. That kind of proves that it's not part of or in the scroll view.
回答3:
I also had the same question & I posted an answer here :)
But what I think is its a NSView containing 2 NSButtons for + & - as posted in my answer linked above.
来源:https://stackoverflow.com/questions/36523078/location-of-add-delete-buttons-for-an-nstableview-in-os-x