我有一个NSComboBox,可以显示没有垂直对齐的文本。有没有一种在NSComboBox中垂直对齐文本的方法

正如你所看到的,它非常奇怪,而且它不会根据字体大小而改变。我已经搜索了NSComboBox Class Reference,但唯一可用的资源是弹出式显示的项目(如intercellSpacing或setItemHeight:)。
提前谢谢你。
发布于 2015-07-02 19:09:38
尝试:
NSComboBox* cbx = ZGKeyComboBox.new;
// NSViewMaxYMargin means: The top margin between the receiver and its superview is flexible.
cbx.autoresizingMask = NSViewMaxYMargin;
cbx.itemHeight = cbx.itemHeight + 3; // addSubview will center vertically
NSRect r = NSMakeRect(x, y, width, cbx.itemHeight + 5);
cbx.frame = r;
...
[parent addSubview: cbx];https://stackoverflow.com/questions/17451119
复制相似问题