0

Let's say that I have a xib with a stack of UIViews on top of each other: The bottom UIView(A) with a UIButton on it and when the button is pressed, this layer is hidden and the next one is shown and put on top.

The next UIView(B) contains a clock counting down from 5 to 0 and when 0 is reached this UIView is hidden and the one described above is moved to front and shown instead.

So just to make it more clear:

the composition of the xib:
A B
--Z direction-->

update: screenshot attached at the bottom of page.

So to my problem:
When (re)positioning the button or the clock using mouse in Xcode they tend to stick to the wrong UIView. The more the Objects and "stacked" UIViews the greater the problem.

The Question:
Is there any way to, as with the layer "eye" in photoshop, isolate the UIViews and work on them one by one?

Observe! I am aware that there are o there ways of achieving this swapping between view BUT this is not the issue. The real problem here is to actually position the button and the clock in the Xcode wysiwyg editor with the least hassle. Observe!

-------- Added for clarification --------
Screenshot I would like to isolate the views visually so when working on one of them, all the others are hidden and not open for interaction.

I would like to isolate the views visually so when working on one of them, all the others are hidden and not open for interaction.

tommys
  • 865
  • 1
  • 11
  • 21

1 Answers1

0

You can drag the second view (B) out of the main view hierarchy and place it below it (on the same level of the main view). That way you'll be able to edit each view separately.

Then you connect that view (B) to an outlet in your viewcontoller inorder to be able to add it to your main view during runtime...just set the frame and add it as a sub view.

Mariam K.
  • 600
  • 4
  • 13
  • Yes, this is how it is setup and as you say it is possible to edit the views separatly, however: one may still by mistake move objects between the different views and all the views are visible at the same time - so not really what I asked for. Thanks for your time and I´m sorry if my question was unclear. – tommys May 03 '13 at 07:12
  • I'm sorry I still can't get the real problem. As far as I know the eye option is not available. Maybe if you added a screenshot that will help. – Mariam K. May 03 '13 at 07:26
  • Added screenshot for clarification. – tommys May 03 '13 at 11:15
  • I see, well what I suggested earlier still can help you here, I see that view B is a subView of the main view (view) therefore it overlaps with A, if you **pull B outside of the main view** to be on it's same level, along with the first responder (that level) you can edit it completely separately. Adding an **outlet** for it will enable you to add it as a subview of "view" in code. (Though you would have to add constraints as well) – Mariam K. May 03 '13 at 21:00
  • I have yet not suceeded in doing what you suggest. It is possible to have both A and B as views on the same level as the viewcontrollers main view, this does however not make them visually editable as they, nor their content, no longer visually present themselves in xcode. – tommys May 07 '13 at 12:18
  • 1
    Have a look at this [answer](http://stackoverflow.com/a/14515818/1262527)...it has an amazing hack to remedy this problem. – Mariam K. May 07 '13 at 15:24