如何使NSButton上面的NSButton?

问题描述:

我有两个NSButtons。两个按钮是与图像。这是我创建的[buttons]( http://i.stack.imgur.com/IYXIE .png )问题是星形按钮总是位于叶子按钮后面。我怎么能把它带到前面。 (搜索Mac osx而不是iOS。)

更新:
这是我在第一次鼠标悬停时获得的,第二次鼠标移到

i'm having two NSButtons. Both button were with images. This is what i created [buttons] (http://i.stack.imgur.com/IYXIE.png) the problem is the star button always located behind the leaf button. how can i bring it front. (searching for Mac osx not iOS.)
UPDATE: this is what i got during first mousehover , got this during second mouse over

[starButton removeFromSuperview];
[self addSubview:starButton positioned:NSWindowAbove relativeTo:nil];

此外,NSView支持方法

Also, NSView supports the method

 sortSubviewsUsingFunction:context:

。需要更多的代码,但看起来更干净。

implement that to simply sort the views.. requires more code but seems more clean.