Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>[searchBarObject setImage:nil forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal]; </code></pre> <p>This work for me.. I hope it will be helpful for you..</p> <p>Updated full code.. <strong>.m file contents in viewDidLoad</strong></p> <pre><code>//Table initialization.......................................................................... my_table = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 320, self.view.frame.size.height)]; //SearchBar initialization...................................................................... UISearchBar *search = [UISearchBar new]; [search sizeToFit]; search.delegate = self; //Make the image in size 20x20................................................................ UIImage *img = [UIImage imageNamed:@"apple.jpg"]; UIGraphicsBeginImageContextWithOptions(CGSizeMake(20, 20), YES, 0); [img drawInRect:CGRectMake(0, 0, 20, 20)]; UIImage *img2 = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //Set the image for the UISearchbarIconSearch................................................... [search setImage:img2 forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal]; search.barStyle = UIBarStyleBlackTranslucent; [my_table setTableHeaderView:search]; [my_table reloadData]; //SearchDisplay initialization.................................................................. UISearchDisplayController *display = [[UISearchDisplayController alloc]initWithSearchBar:search contentsController:self]; sbc = display; // display.delegate = self; display.searchResultsDataSource = self; display.searchResultsDelegate = self; my_table.dataSource = self; my_table.delegate = self; [self.view addSubview:my_table]; </code></pre> <p><strong>.h file.</strong></p> <pre><code>@interface ViewController : UIViewController&lt;UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate, UISearchDisplayDelegate&gt; { NSArray *table_array; UITableView *my_table; UISearchDisplayController *sbc; NSArray *filtered; } @end </code></pre> <p>This is my code which change the search icon image...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload