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

The Archive Base Latest Questions

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

I have encountered the weirdest display bug with my UISearchBar . Here is my

  • 0

I have encountered the weirdest display bug with my UISearchBar.
Here is my code that works perfectly in another app. (I create the search bar in code because a xib file is not feasible.)

searchBar = [[UISearchBar alloc] initWithFrame:
    CGRectMake(0, 0, self.tableView.frame.size.width, 44)];
searchBar.delegate = self;
searchController = [[UISearchDisplayController alloc] 
                   initWithSearchBar:searchBar contentsController:self];
searchController.delegate = self;
searchController.searchResultsDataSource = self;
searchController.searchResultsDelegate = self;
self.tableView.tableHeaderView = searchBar;

The search functionality etc. works fine. But strangely, the search bar looks like this, both on the device and the simulator:

UISearchBar with display bug

  • The placeholder string should not be there, but further to the right.
  • When I enter search text it also starts too far left, with the magnifying glass icon showing through.
  • Also, setting searchBar.placeholder or searchBar.prompt to @"" or nil does not remove this “Search” placeholder. (However, a
    searchBar.placeholder = @"FooBar";
    will display “FooBar”, but still in the wrong position.
  • Finally, I find it strange that the string is “Search” although I have set the language to something else (say, German).

Any help? The most pressing problem is to get the text to over the right.

  • 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:49:37+00:00Added an answer on May 24, 2026 at 12:49 am

    That behavior can be caused by overriding either (CGRect)editingRectForBounds:(CGRect)bounds or - (CGRect)textRectForBounds:(CGRect)bounds. Have you altered either of those in a UITextField category elsewhere in your app? The purpose of doing that may have been to add padding to a text field (which can instead be accomplished with an invisible leftView). In this case, your custom “padding” is being applied to the UISearchBar text field.

    Such a category on UITextField will also cause your app to crash while initializing framework classes that use UITextField, such as MFMailComposeViewController, so it is a bad idea for several reasons.

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

Sidebar

Related Questions

i have encountered a really weirdest bug in eclipse, i would love if someone
I have encountered some odd characters that do not display properly in Internet Explorer,
Okay, this is by far the weirdest bug I have ever encountered. It's pretty
I have encountered a rather odd error that I do not understand. I created
I have encountered a problem that I have not come accross yet when setting
I am debugging some code and have encountered the following SQL query (simplified version):
I have encountered a strange Invalid Packet Lenght (that is how the error is
I have encountered the following problem which proved to me that I know far
I have encountered an annoying bug with internet explorer on a javascript animation I
I have a new web app that is packaged as a WAR as part

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.