-1

lets say I have a view controller with several buttons in it. then each button pops up a large uiview into the screen. each one of these uiviews contains, several more buttons, textfields etc. How do I manage this in interface builder? It's not easy to layer elements because theres no visibility option (like photoshop) if I put something in front of another element I can't see the element behind it..

Is there a way to edit objects outside of the main view in interface builder so that they are visible, and then insert them programatically when they are needed? I realize you can do entire layouts programatically but sometimes it can be much easier to just drag things around the way you like. It just becomes cluttered when theres a lot going on.

hamobi
  • 7,940
  • 4
  • 35
  • 64
  • It seems that you need an entirely different view to access these options. From the usability point of view, probably it is better to flip the views. – Ilan Aug 06 '13 at 17:29

1 Answers1

1

Yes, you can create UIViews outside of your main view in your nib file, link this UIViews and add them to your shown view by code.

In your view controller write something like this:

IBOutlet UIView *aView;

Interface Builder looks like this:

enter image description here

Link it in interface builder and show it this way (when needed):

[self.view addSubview:aView];

You can also use some animation effect if needed.

In aView you can add any object, UILabel, UIImageView, etc...

This is a basic question in iOS so I suggest you to read this, about UIView class and its methods.

Giuseppe Garassino
  • 2,272
  • 1
  • 27
  • 47
  • does this concept still apply to storyboards? – hamobi Aug 06 '13 at 17:41
  • This should work with storyboards as well... Take a look here: http://stackoverflow.com/questions/14139564/create-a-standalone-view-in-storyboard-to-use-programatically – Giuseppe Garassino Aug 06 '13 at 17:44
  • ahhh so you really need to create a new xib file and subclass uiview? then add that into your view controller as an outlet? do you need to #import any files when you take this approach? – hamobi Aug 06 '13 at 17:54