Search code examples
objective-ciosxcodestoryboardsubview

how to add subview over storyboard?


I have a ViewController and I want to add 3 subviews in the content part.

On the top i would put some 3-line fixed text and then tabBar (or segment control, I don't know what is best) and then subview.

I want to create something such that it looks like this image example:

An example of the above problem

Specifically, my questions are:

  1. How to add over IB in storyboard 3 subviews (with labels and textViews)
  2. How to switch them over TabBar or segment

Solution

  • create an IBoutlet in your header file and synthesize it. hold conrtol and drag it to your header file. choose iboutlet give it a name. you are good to go. then use your outlet

    [self.myview addSubview:mysubview]
    

    download the sample project