Multiple views in Xcode storyboard view controller, one of them won't appear in storyboard editor

15,984

Solution 1

I know it makes no sense, but you can drag it into the first view (temporarily) to edit it via the storyboard. I think this is absurd, but it does work.

enter image description here

Solution 2

I had this issue some times ago, and the only method I found to work graphically on the hidden view was to:

  • add another temporary ViewController to the Storyboard
  • assign the correct class to it (MainViewController, in your case)
  • delete it's main view (left menù, command + backspace)
  • select the hidden view from the original ViewController and drag it in the new one, exactly under the "Main View Controller" icon (always using the left menù, the one you attached in the image)
  • work on the view, add control and graphics, even connecting outlet / actions
  • when finished working on the view, drag the view back to it's original position
  • delete the temporary view controller

The outlet should stay connected. If you use command-x / command-v (cut/paste) you lose the outlets.

Let me know

Share:
15,984

Related videos on Youtube

Chris Hart
Author by

Chris Hart

Updated on June 25, 2022

Comments

  • Chris Hart
    Chris Hart almost 2 years

    I'm having trouble updating a project someone else created in Xcode. This is an app built in storyboard and in one case, there is a scene with a view controller that has multiple views underneath it in the document outline palette of the storyboard editor (shown in included image). The first view is the one that becomes highlighted in the storyboard editor when it is clicked on, and as you change the design or the objects in the view that view is updated. There is a second view (the one beneath exit and first responder) that is somehow attached to that scene but I cannot figure out how to edit the design of that view. If I click on that view or any of it's children, I can clearly see their attributes in the various inspectors on the right hand side (connections, attributes, etc.).

    (edit 1 - the original version of this question suggested that these additional views were used for special layouts needed when switching to landscape. They are actually used more generally than that, for example, when displaying popups over the active view.)

    In any event, my primary interest is in being able to modify this second view. It seems like there must be a way to see it in the editor and I'm just missing it. I've searched for tutorials on implementing portrait and landscape views in storyboards (none seem to use this method), for phrases like "multiple views in storyboard scene", and looked through the menu options (including a promising option "unembed" when the second view is selected, but when clicked it removes the view from the scene and then I can't find it). I'm at a loss of where to look to learn more. How can I edit this view? Any help is appreciated.

    ViewController scene in document outline

  • Chris Hart
    Chris Hart over 11 years
    It is absurd, but I'm glad I didn't miss some other more elegant way of doing this. This seems like the easiest way to do it. Thanks!
  • Chris Hart
    Chris Hart over 11 years
    Thanks - this did work for me, but jhilgert00's solution was a little easier and less prone to error. Really appreciate the quick response though, your answer got me though the first few changes I needed to make!
  • LombaX
    LombaX over 11 years
    Before finding this I tried the same solution explained by jhilgert00, afair it worked bad because it changed my main view layout every time the secondary view was dragged into the main one. But it was in an older xcode version or a problem with a particular layout, if now it works it's a faster and simpler solution ; )
  • MathewS
    MathewS over 10 years
    Since Xcode5 update this has been the most convenient method I've found.