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

  • Home
  • SEARCH
  • 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 8998975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:06:52+00:00 2026-06-16T00:06:52+00:00

I know how to remove/change UISearchBar background color around search field: [[self.searchBar.subviews objectAtIndex:0] removeFromSuperview];

  • 0

I know how to remove/change UISearchBar background color around search field:

[[self.searchBar.subviews objectAtIndex:0] removeFromSuperview];
self.searchBar.backgroundColor = [UIColor grayColor];

achieved UISearchBar customization

But don’t know how to do this inside it like that:

desired UISearchBar customization

This needs to be compatible with iOS 4.3+.

  • 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-16T00:06:53+00:00Added an answer on June 16, 2026 at 12:06 am

    Use this code to change the searchBar’s UITextField backgroundImage:

    UITextField *searchField;
    NSUInteger numViews = [searchBar.subviews count];
    for (int i = 0; i < numViews; i++) {
        if ([[searchBar.subviews objectAtIndex:i] isKindOfClass:[UITextField class]]) { //conform?
            searchField = [searchBar.subviews objectAtIndex:i];
        }
    }
    if (searchField) {
        searchField.textColor = [UIColor whiteColor];
        [searchField setBackground: [UIImage imageNamed:@"yourImage"]]; //set your gray background image here
        [searchField setBorderStyle:UITextBorderStyleNone];
    }
    

    Use the below code to change the UISearchBarIcon:

     UIImageView *searchIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourSearchBarIconImage"]];
    searchIcon.frame = CGRectMake(10, 10, 24, 24);
    [searchBar addSubview:searchIcon];
    [searchIcon release];
    

    Also, to change the searchBar icon you can use the following built-in method on UISearchBar (which is available from iOS 5+):

    - (void)setImage:(UIImage *)iconImage forSearchBarIcon:(UISearchBarIcon)icon state:(UIControlState)state
    

    Here you can set 4 types of UISearchBarIcon i.e.:

    1. UISearchBarIconBookmark
    2. UISearchBarIconClear
    3. UISearchBarIconResultsList
    4. UISearchBarIconSearch

    I hope this help you…

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

Sidebar

Related Questions

I'd like to know how to remove the background grid from asp.net charts, I
Ok, I know it is best practice that once you change or remove a
Collection.bind('change',this.function, this); Collection.bind('add',this.function, this); Collection.bind('remove',this.function, this); Collection.bind('reset',this.function, this); I know these four, but what
I would like to remove or change color of image overlay at the end
I know you have to synchronize around anything that would change the structure of
I am curious to know if there is anyway I can remove OR change
I know that when you add/change/remove methods in a COM interface you're supposed to
anyone know of any issues using a link_to_remote to change the state of the
I know modern browsers remove most space chars and '&nbsp'; characters insider a paragraph
Can anybody know how to remove all the indexes from database ?

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.