Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 496103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:39:16+00:00 2026-05-13T05:39:16+00:00

I have one main view with an associated controller. I have some rather complicated

  • 0

I have one main view with an associated controller. I have some rather complicated toolbars that I need to switch in and out depending on user interaction.

To keep things simple I manage the toolbars with my main view controller, rather than having all sorts of intertwined dependencies or really deep delegate chains.

Anyway, how can I have multiple views in one xib and initialize them properly? Like if I want to display one of my custom views in the center of the screen, how would I do that?

Alternatively, if I separate the views into multiple xibs, how can I have them reference the same controller object for their IBOutlets/IBActions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:39:16+00:00Added an answer on May 13, 2026 at 5:39 am

    Anyway, how can I have multiple views
    in one xib and initialize them
    properly? Like if I want to display
    one of my custom views in the center
    of the screen, how would I do that?

    You can have as many UIViews as you want in your xib. Usually you’ll make one the “primary” view — the one that’s hooked up to the File Owner’s view property (i.e. your view controller) — and the rest can sit in the xib at the same level. You can hook them up to other properties in the view controller as well.

    You could make these views as subviews for the main view. (Few, that’s a lot of view). Let’s say you have two views, FooView and BarView. You want FooView to be present at startup. So you just set BarView to be hidden in IB. Then your view controller might look something like this:

    @interface MyViewController : UIViewController
    {
        FooView* fooView;
        BarView* barView;
        ...
    }
    ...
    @property (nonatomic, retain) IBOutlet FooView* fooView;
    @property (nonatomic, retain) IBOutlet BarView* barView;
    ...
    

    Then, inside your code, when you want to change views, just use the setHidden: method to hide one and show the other.

    Alternatively, if I separate the views
    into multiple xibs, how can I have
    them reference the same controller
    object for their IBOutlets/IBActions?

    You can have other xibs sharing the same view controller. I’ve done it lots myself. Just set the File Owner to the appropriate class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my iOS app i have one view controller that handles my main view.
My application is set up using ViewFlipper so that I have one main View
I have below html code in one of the opensource project. <form action=/wiki/bin/view/Main/Search> <div
I have one main parent swf that loads several other swfs. If something happens
We are installing out program via inno setup. We have one main exe file,
i have one main relative layout in that i have buttons and in middle
I have two backbone Views. One is the main view and the other is
I hava a main view, where you have one object and you can change
I have a silverlight mvvm application that loads main view with 2 user controls
I have several views inside one main view. Those views are all behind one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.