overlapping controls - z order

Discussion in 'Mac Programming' started by McBgnr, Apr 19, 2009.

  1. McBgnr macrumors regular

    Joined:
    Apr 13, 2009
    #1
    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!
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    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.
     
  3. WhiteRabbit macrumors newbie

    Joined:
    Jan 11, 2005
    #3
    Interface Builder is equiped with a "Send to back" utility listed under the Layout menubar item.
     
  4. McBgnr thread starter macrumors regular

    Joined:
    Apr 13, 2009
    #4
    Gr8... wasn't aware of the menu option... Now I can easily put the controls back and bring them forward.
     
  5. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #5
    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.
     
  6. McBgnr thread starter macrumors regular

    Joined:
    Apr 13, 2009
    #6
    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.
     

Share This Page