I need to replicate the function of bringSubviewToFront: on the iPhone, but I am programming on the Mac. How can this be done?
Haven't actually tried this out - and there may be better ways to do it - but this should work:
NSView* superview = [view superview];
[view removeFromSuperview];
[superview addSubview:view];
This will move 'view' to the front of its siblings
also be sure to enable the layer for quartz rendering:
...
NSImageView *anImage = [[NSImageView alloc] initWithFrame:NSRectMake(0,0,512,512)];
[anImageView setWantsLayer:YES];
...
otherwise, your layer cannot be rendered correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With