Hi,
I have an application which has a tabbar in it.
once the user clicks lets say 3rd tab item, it loads the thirdViewController and thirdView.xib.
I opened this xib file in interface builder and put inside a UIView and called it a subViewsContainer.
Also connected this with an IBOutlet of the same type in my thirdViewController.
In my controllers interface (.h) I created 2 different views which will be added as a subview to my container view when the user presses on 2 different buttons in this view.
Each time a user presses button1 I remove all subviews of my container, alloc and init my 1st subview and add it to my container and release my 1st subview.
the same goes for button2 and my 2nd subview..
Now my question is:
Since I created these 2 subviews in my thirdViewController, they dont have any xib. But now i want to add visual elements via interface builder. But cannot.. (since they don't have xibs or an m or h files of their own..)
Is there a way I can design and add items to the subviews I created using code in interfacebuilder?
Hi,
I have an application which has a tabbar in it.
once the user clicks lets say 3rd tab item, it loads the thirdViewController and thirdView.xib.
I opened this xib file in interface builder and put inside a UIView and called it a subViewsContainer.
Also connected this with an IBOutlet of the same type in my thirdViewController.
In my controllers interface (.h) I created 2 different views which will be added as a subview to my container view when the user presses on 2 different buttons in this view.
Each time a user presses button1 I remove all subviews of my container, alloc and init my 1st subview and add it to my container and release my 1st subview.
the same goes for button2 and my 2nd subview..
Now my question is:
Since I created these 2 subviews in my thirdViewController, they dont have any xib. But now i want to add visual elements via interface builder. But cannot.. (since they don't have xibs or an m or h files of their own..)
Is there a way I can design and add items to the subviews I created using code in interfacebuilder?
Thank you
Declare your views in .h as "IBOutlet UIView *yourViewName" and then add a view in IB then connect them.
Declare your views in .h as "IBOutlet UIView *yourViewName" and then add a view in IB then connect them.
Thank you,
but now i cannot add subview and release it right?
because since i added views from the interface builder now they are already allocated and initialized?
in order to switch between views using my buttonsi have to use hidden = yes or no then?
Setting the view's background color is one way to test the view i your xib.. if u are not seeing the particular view in the app, then you can set reduce its alpha value of just hide it..
Setting the view's background color is one way to test the view i your xib.. if u are not seeing the particular view in the app, then you can set reduce its alpha value of just hide it..
hi bharath,
i already see that the views work fine when i run my app.
i now want to add stuff to each view through IB and my problem is not while the app is running but during the editing process in Interface Builder where I created a label for instance and dragged it under the 1st subview, but when i want to move it around, i'm trying to drag it by holding it, but the interface builder thinks i want to drag the 2nd subview.
(oh did i mention that these 2 subviews overlap )
so it's hard to edit them :/
i wonder if anyone could understand anything from my way of telling it
In interface builder, there is a window which displays your Fule owner, view and other objects.. In e same window youndo hace option to view the View hierarchy in a tree view, Browser view ( simi,ar to how you see Files i filnder)..
these options will help you to ick a particular component at will..
( i just have an ipaf now, otherwise i could got you a snaoshot)