PDA

View Full Version : overlapping controls - z order




McBgnr
Apr 19, 2009, 12:49 PM
In my application, I thought of putting a background image towards the end of UI development. This window in which I wanted to put the background image had numerous controls with references. Although adding the image object to the window is simple, but what I was not able to achieve is to put the image behind my controls. Thus this window showed only the image at runtime. Then I had to redesign this window from the scratch. This resulted in loss of references, which had to be set again.

Was just wondering if there is some way of avoiding this rework...Pls suggest!



kainjow
Apr 19, 2009, 06:44 PM
Why would you have to redesign from scratch? You could have copied the controls to a temporary view. Or if you had them in an existing view, select that view and drag it to your nib window, which would make a copy of the view with all the controls in tact. Yes some of the connections may break but that doesn't take long to setup again.

If your view/window is overly complicated, consider splitting it up into multiple views and combine them back together in code (or simplifying your UI). I do this often for split views and other views that aren't always visible in the main view/window.

WhiteRabbit
Apr 20, 2009, 12:53 AM
Interface Builder is equiped with a "Send to back" utility listed under the Layout menubar item.

McBgnr
Apr 20, 2009, 12:57 AM
Gr8... wasn't aware of the menu option... Now I can easily put the controls back and bring them forward.

kainjow
Apr 20, 2009, 11:39 AM
Interface Builder is equiped with a "Send to back" utility listed under the Layout menubar item.

That actually doesn't really always work. Maybe in some instances, but if you're relying on it to keep the order it won't always work, at least that is what I've found.

The best way to maintain stacking order is to use subviews.

McBgnr
Apr 20, 2009, 01:48 PM
Thanks kainjow.

I have just tried it on a simple window with two overlapping controls... Will try using subviews as well, for making the order.