OS X version of bringSubviewToFront:?

前端 未结 6 735
我在风中等你
我在风中等你 2021-02-08 19:07

I need to replicate the function of bringSubviewToFront: on the iPhone, but I am programming on the Mac. How can this be done?

6条回答
  •  佛祖请我去吃肉
    2021-02-08 19:39

    Pete Rossi's answer works, but remember to retain the view when you remove it from the superview.

    You can add this in a category on NSView :

    -(void)bringSubviewToFront:(NSView*)view
    {
        [view retain];
        [view removeFromSuperview];  
        [self addSubview:view];  
        [view release];
    }
    

提交回复
热议问题