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 6062973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:06:45+00:00 2026-05-23T09:06:45+00:00

I have a view that has a UISegmentedControl in its bottom UIToolBar with 2

  • 0

I have a view that has a UISegmentedControl in its bottom UIToolBar with 2 segments. The view when loaded should default to view 1. Then when segment 2 is selected, it should switch to view 2, etc.

Right now, when I click segment 2, it hides the view 1, then switches to the 2nd view, but how do I keep the segmentedControl displayed? When view 1 is hidden, the control is hidden as well.

Do I need to create 3 views total? And have views 1 and 2 as subviews of the default view that only has the segmented control in it?

EDIT:

- (void)segmentedControl:(SVSegmentedControl*)segmentedControl didSelectIndex:(NSUInteger)index
{
    LogResultsViewController* v1 = [[LogResultsViewController alloc] initWithNibName: @"LogResultsViewController" bundle:nil];
    CalendarController* v2 = [[CalendarController alloc] initWithNibName: @"CalendarController" bundle:nil];

    if (index == 0)
    {
        [self.view addSubview: v1.view];      
    }
    else
    {
        [self.view addSubview: v2.view];
    }
}

And this is the code used to load this view:

- (void)loadView 
{
    UIBarButtonItem *actionButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(dismissCalendarView)];
    self.navigationItem.leftBarButtonItem = actionButton;
    [actionButton release];

    int statusBarHeight = 20;
    CGRect applicationFrame = (CGRect)[[UIScreen mainScreen] applicationFrame];
    self.view = [[[UIView alloc] initWithFrame:CGRectMake(0, statusBarHeight, applicationFrame.size.width, applicationFrame.size.height)] autorelease];
    self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    self.view.backgroundColor = [UIColor grayColor];
    calendar.frame = CGRectMake(0, 0, calendar.frame.size.width, calendar.frame.size.height);

    [self.view addSubview:calendar];
    [calendar reload];
}
  • 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-23T09:06:46+00:00Added an answer on May 23, 2026 at 9:06 am

    Yes, that’s exactly what you need to do. Set up a container view that holds the toolbar and the other views. Then add and remove the other two views as subviews of the container view as needed.

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

Sidebar

Related Questions

Hey I have a view that has a button that when pressed should modally
I have a view that has a list of jobs in it, with data
I have a navigation view with a cell that has something as simple as
I have a plug-in to an Eclipse RCP application that has a view. After
How does your employer limit/prevent pirating of its products? Some have the view that
I have a view that has a background image and a CGPath that gets
I have a view that has a navigationController with two buttons, START (essentially a
I have a View that has a UIWebView, and an OptionsPane (Custom UIViewController with
I have a View that has a single TextBox and a couple Button s
I have a view that has a custom ArrayAdapter as a ListAdapter. Customer is

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.