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

  • Home
  • SEARCH
  • 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 6180395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:50:14+00:00 2026-05-24T00:50:14+00:00

I have 3 separate view controllers with their own NIB file. I have a

  • 0

I have 3 separate view controllers with their own NIB file.

I have a overview view in my app with a segmented control that you can toggle through. Instead of copying all 3 of these view’s methods and putting them into this overview’s class, is it possible to just load each view as a subview of the overview view deepening on which segment is selected?

- (void)segmentedControl:(SVSegmentedControl*)segmentedControl didSelectIndex:(NSUInteger)index
{
    switch (index)
    {
        case 0:
        {
            MusclesTableViewController *musclesTableViewController = [[MusclesTableViewController alloc] initWithNibName:@"MusclesTableViewController" bundle:nil]; 
            [self.view addSubview: musclesTableViewController]; 
            [musclesTableViewController release];  
        }
            break;
        case 1:
            // load second nib and add it as a subview    
            break;
        default:
            break;
    }
}
  • 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-24T00:50:14+00:00Added an answer on May 24, 2026 at 12:50 am

    Connect an action to your segment controller:

    [yourSegmentedControl addTarget:self action:@selector(changeSegment:) forControlEvents:UIControlEventValueChanged];
    

    use your method to load the desired subview:

    - (void)changeSegment:(id)sender {
        UISegmentedControl *segment = sender;
    
        switch ([segment selectedSegmentIndex]) {
            case 1:
                // load first nib and add it as a subview
            break;
            case 2:
                // load second nib and add it as a subview    
            break;
            default:
            break;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a nib file for the full version of the app. Buttons in
I'm starting an app where I'd like to have multiple view controllers. Some of
I'm using iphone sdk 3.1.2. I have 3 root view controllers each on separate
So, I develop the app that uses sqlite3 database methods. I have several view
I have a question regarding keeping the controller and view separate. It seems to
I have a view table which is a union of two separate tables (say
I have 2 separate java services that use a complex type that is a
here is a quick question, i have my couple view controllers classes, and have
I have a really strange orientation issue. I have a sequence of view controllers
I'm working on a multiview app for iPhone and currently have my views (VIEW)

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.