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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:02:59+00:00 2026-06-09T21:02:59+00:00

previously I had a UITableViewController with a UISearchBar and it was showing up at

  • 0

previously I had a UITableViewController with a UISearchBar and it was showing up at the top by using self.tableView.tableHeaderView = searchBar;

Now I had to redo some things and ended up with a UIViewController which shows 2 UITableView's. I wanted the upper one to show the search bar but now it’s not being shown.

Now I’m using [MyView setTableHeaderView:searchBar]; in viewDidLoad Method to add the searchBar to the TableView.

In the UIViewController the code is almost the same as in the UITableView (searchbar initialized and frame created as well as tableview initialized)

Any ideas what I’m doing wrong?

EDIT: Idea behind all this to have a list in the upper tableview (including search bar) and another uitableview where I can choose some filtering options.

(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Custom initialization
    searchResult = [[NSMutableArray alloc] init];

    LexikonView = [[UITableView alloc] initWithFrame:CGRectMake(0, 44, 320, 337) style:UITableViewStylePlain];
    LexikonView.dataSource = self;
    LexikonView.delegate = self;
    [self.view addSubview:LexikonView];

    FilterView = [[UITableView alloc] initWithFrame:CGRectMake(0, 381, 320, 0) style:UITableViewStylePlain];
    //FilterView.dataSource = self;
    //FilterView.delegate = self;
    [self.view addSubview:FilterView];
}
return self;
}

(void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib

searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
searchBar.autocorrectionType = UITextAutocorrectionTypeYes;

searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];

searchDisplayController.delegate = self;
searchDisplayController.searchResultsDataSource = self;

[LexikonView setTableHeaderView:searchBar];
}

For now I just want the searchbar to work again (as it did using a uitableviewcontroller). If I reduce the size of the upper tableview I only see empty space. I added a UISearchBar in IB and voilá there it is, but the delegate methods are not called.
And yes I want the searchbar to be always visible at the top of the tableview

  • 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-09T21:03:00+00:00Added an answer on June 9, 2026 at 9:03 pm

    I think you want a TableView with a SearchBar that is always visible right? If this is the case, you just need to add a TableView to a ViewController and leave room at the top for the SearchBar. Add the SearchBar independently of the TableView. I have a post that shows how this is done and also gives you some direction for really fast searching of the backing data for the TableView.

    If this isn’t what you are after, please be a little more specific in what your goals are here. Also please post the code you are using to try to accomplish what you are trying to do.

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

Sidebar

Related Questions

Previously i had some experience with MS Access and now i am doing JDBC,
I previously had a table that is created using hibernate entities. I am using
I have a C# project that I previously had targeting .NET 4.0, and now
I have a webpage that previously had no doctype declaration. Now, I've added <!doctype
I'm using IntelliJ 9.0.1. I have the Debug panel open. I previously had an
I previously had Passenger 2.2.13 install with NGINX 0.7.65 - I want to install
I previously had a post on this issue that was resolved. However since rebuilding
I have a follow-up question regarding an issue I previously had on SO here
Here is the site in question: http://jayduff.co.uk/ I previously had the images/links on the
I have an application that uses CoreData. I previously had a class named Marker

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.