tags:

views:

39

answers:

2

I have seen the iPhone equivalent of this question here and I'm wondering... is there an equivalent for bringSubviewToFront: for OS X development? I need something to send an NSImageView "to front".

A: 

Actually I think I found an answer (1 min after asking the question :D)... should have thought about things a bit more before asking.

I'm thinking addSubview:positioned:relativeTo: would be suitable for my needs. However I am still searching for a way that doesn't involve "addSubview".

Nano8Blazex
+2  A: 

Send IB object to back programmatically

Interface Builder has no relevance here. Views and other UI objects in Cocoa behave the same and provide the same capabilities whether created in IB or created programmatically in your code.

… is there an equivalent for bringSubviewToFront: for OS X development? I need something to send an NSImageView "to front".

Be warned:

Cocoa does not enforce clipping among sibling views or guarantee correct invalidation and drawing behavior when sibling views overlap.

You may want to consider switching to CALayer for the things that need to overlap.

As a bonus, this may help you reuse code between Mac OS X and the iPhone OS.

Peter Hosey
I see. I'll reconsider what I'm doing then.
Nano8Blazex