5

seems like Apple change how Interface Builder behaves in Xcode 8? Because when I check hidden in Attributes Inspector on a view in Interface Builder, that view is still visible.

This makes it very tedious to work with views where some views needs to be the view with the highest "z value", the front most view that is.

Is there some other way to show the green view in this example, than to change the order of them to the right (i.e. change their "z value")

In the image below hidden is checked, but I still don't see the green view below. You can download this trivial project at github

When the project is run, the green view is indeed shown, but the issues is that it is annoying when working in Interface Builder.

enter image description here

Am I missing something?

Sajjon
  • 5,608
  • 2
  • 41
  • 77

3 Answers3

5

I have the same opinion on it and I also believe that it's annoying. I with they gave you the choice to update the actual storyboard before runtime or not but they didn't so for now we have to deal with it.

There is a quick alternative option though. Hidden will not update in the storyboard but alpha will. If you change the alpha it will update in the storyboard so if you want to see the view behind it just change alpha to 0. You can always change it back easily or if your doing it in code, instead of unhiding your view just change the code so the alpha is set to 1.

msweet168
  • 371
  • 1
  • 18
  • Thanks for the nice tip. – Borzh Oct 31 '16 at 22:21
  • Alpha thing does not really work if the element is part of a UIStackView. With hidden, the element will, at runtime, appear as if it is not part of the stack view, but just changing the alpha 0 will have it invisible but still take up space in the stackview. This makes this workaround ineffective in IB. – Jonny Apr 10 '17 at 03:38
3

How about unchecking the installed checkbox of the red view? This has also the flaw that you have to remember to reinstall it, but you don't have to change the z-order of your views.

Paul Schröder
  • 1,138
  • 8
  • 19
1

This is deliberate. We wouldn't want a view to be hidden from you, the editor, just because it will be hidden when the app runs. You can easily select a covered view, such as the green view, using Shift-Control-Click on the red view (or use the document outline at the left of your screen shot).

matt
  • 447,615
  • 74
  • 748
  • 977
  • But how can I see how the Green View looks like in Interface Builder, without changing the Z order? The Red view blocks it... – Sajjon Sep 20 '16 at 14:29
  • You _can_ change the Z order. Just bring the green view to the front. In the document outline on the left, drag it down below the red view. Or select it as I said before, in the canvas, and choose Bring To Front. Just remember to put it back when you're done! – matt Sep 20 '16 at 14:38
  • 1
    But that is exactly what I **don't** want to do, I don't wanna have to remember to put it back... Easy to forget! – Sajjon Sep 20 '16 at 14:40
  • 2
    I know what you don't _want_ to do. I'm telling you what you _can_ do. My answer is intended to be true, not to thrill you to the marrow. If you don't like it, file an enhancement request with Apple — don't blame _me_. – matt Sep 20 '16 at 14:46
  • 1
    Hehe well if it is not possible, then it isn't... and that is a flaw in design by Apple IMHO. – Sajjon Sep 20 '16 at 14:46
  • IMO this is a bad design decision. The point of IB should be WYSIWYG, at least compared to writing code. – Jonny Apr 10 '17 at 04:03
  • @Jonny the _preview_ in IB is WYSIWYG (shown in the assistant editor), but the canvas is not and never has been. The expectation that it would be is just silly. After all, the drag handles, the frame rectangles, the guidelines, are all things that won't appear in the running app. Besides, if a Hidden view were completely invisible, how would you even select it? Or even know of its existence? – matt Apr 10 '17 at 04:12
  • @matt I must be doing something wrong because hidden views are still visible in preview. If views were hidden, you could select them using control-shift-tap (where you guess they might be), or use Document outline (I use this one a lot myself). – Jonny Apr 10 '17 at 05:53