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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:33:35+00:00 2026-06-17T20:33:35+00:00

I have create a UIViewController with multiple subviews.. To switch to all subviews i

  • 0

I have create a UIViewController with multiple subviews.. To switch to all subviews i have added a segmented control.. screen looks like this..

enter image description here

On the second view i have added a UIToolbar, using this line of code..

    toolbar = [UIToolbar new];
    toolbar.barStyle = UIBarStyleDefault;
    [toolbar sizeToFit];
    toolbar.frame = CGRectMake(0, 0, 800, 40);

    UIBarButtonItem *filterByClass = [[UIBarButtonItem alloc] initWithTitle:@"A" style:UIBarButtonItemStyleBordered target:self action:@selector(goToFilteredByClass:)];

    UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];

    NSArray *buttonItems = [NSArray arrayWithObjects:filterByClass, spacer, nil];
    [toolbar setItems:buttonItems animated:NO];

So the screen will look like this..

enter image description here

when i go back to segment A, here’s my screen..

enter image description here

then data is covered by the toolbar.. I want to remove it because segment A doesn’t have a toolbar.. Is there a way to fix this issue..?

Thanks,

Link

  • 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-06-17T20:33:36+00:00Added an answer on June 17, 2026 at 8:33 pm

    Set up an action in your view controller, and have your segmented control call that action when its “value changed” event fires.

    The segments of the control are numbered like an array, from 0 onwards. In your action method, you test for the segment you’re interested in (in this case, segment 0) and show or hide the toolbar. You could animate it offscreen too, if you prefer a sliding animation.

    If you aren’t worried about leaving the toolbar for reuse later, you could use removeFromSuperview in your action method; but you won’t get the animation if you use this method.

    Quick example for hiding it using Core Animation:

    -(IBAction)segmentedControlValueChanged:(UISegmentedControl *)sender
    {
    
       switch (sender.selectedSegmentIndex) {
          case 0:
             // A was pressed, so hide the toolbar
             [UIView animateWithDuration:0.2
                     animations: ^(void) { toolbar.alpha = 0.0; }];
             break;
          case 1:
             // B was pressed so show the toolbar
             [UIView animateWithDuration 0.2
                     animations: ^(void) { toolbar.alpha = 1.0; }];
             break;
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this scheme: I create a storyboard and subclass the UIViewController to MyViewController
I have create a vcf file that contains contacts by using this code ContentResolver
I have create name range on sheet A so I need to use this
I have a UINavigationController (to use like a wizard page) which I create programmatically
I want to create 2 UITableView programmatically in a UIViewController. I have 2 NSMutableArray
Possible Duplicate: Create a UIViewController that contain a UIViewController I have a parent view
This one is stumping me. I have a CALayer which I create in a
I'm currently making ipad application. I have create an uiviewcontroller which is appear with
I have written a subclass of UIViewController which creates a view programmatically, instead of
I have a simple UIViewController whose view is created via a Nib. Here's the

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.