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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:29:04+00:00 2026-06-13T06:29:04+00:00

My ViewController is a custom UIViewController <UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate, UISearchDisplayDelegate> . I have set

  • 0

My ViewController is a custom UIViewController <UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate, UISearchDisplayDelegate>. I have set up the UISearchBar to display a scope bar.

I instantiate the view controller once and then show the same view on demand via [self presentModalViewController:mySearchController fromView:self.view];

Now, when I configure the view controller to be displayed as a form sheet, the scope bar appears only the first time the view is shown. The next time the scope bar is not displayed.

Displaying the view as a page sheet works fine. However in this case I observe that the first time the scope bar is already in place, while thereafter it is animated into the search bar as soon as it becomes the first responder.

I fiddled around with the view and controller settings in the inspector without any success.

What is causing this behavior?

How can I make the scope bar appear in the form sheet the next time I am showing the view?

Is there a way to prevent the UISearchBar from going into a different state when its view is hidden/redisplayed?

  • 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-13T06:29:05+00:00Added an answer on June 13, 2026 at 6:29 am

    Set the scope bar titles in search delegate for begin editing and make it nil when the search ends. And add the showScopeBar method right after this method. Try and check if that helps.

    For eg:-

    - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar { 
      [searchBar setScopeButtonTitles:[NSArray arrayWithObjects:@"Title1", @"Title2", nil]];
      [searchBar setShowsScopeBar:YES];
      //...
    }
    

    And in didEndEditing,

    - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar {
      [searchBar setScopeButtonTitles:nil];
      [searchBar setShowsScopeBar:NO];
      //..
    }
    

    In addition to this, whenever you want to display the scopebar you can use the above lines to show and hide it.

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

Sidebar

Related Questions

I have a custom UIViewController and custom UIView. I'd like to override the viewcontroller.view
I have a UIViewController which uses the UITableViewDelegate and UITableViewDataSource. I have created UITableView
I have a custom viewController called SourceListViewController, and I'm adding it into a UINavigationController,
I have one ViewController, in this i have added one Custom UIView named as
I have a UITableView in a ViewController class. The ViewController class uses a custom
I have a table view controller with custom cells. In those cells i added
In my custom View which I have added to my viewControllers's view, I need
I have a segue (called ToSettingsSegue ) that pushes a custom view controller (
In a word, how? I have a view controller that creates a few custom
I have a UITableView , which I am controlling from a custom UIViewController .

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.