How do you get the default insets of NSViews and NSControls?
I'm writing some custom layout code to align some NSView
s. I loop through all the views and set their frame.origin.x to the same value (left alignment), but the views don't look like they're aligned properly. I looked at left aligned views in Interface Builder, and each different class of view has a different frame.origin.x value.
For example, to left align an NSPopUpButton
with an NSTextField
, the frame.origin.x value of the NSPopUpButton
has to be 3 pixels less than that of the NSTextField
.
I found a method ibLayoutInset
in Inter开发者_JAVA技巧faceBuilderKit.framework
that appears to be what I want, but none of the AppKit views implement the method.
Does anyone know how to get these inset values programmatically?
Aside from measuring yourself and building your own table of offsets, you can’t. This is rather annoying, and it’s probably best to file a bug report, here: http://bugreport.apple.com
精彩评论