title: Customizing UISearch bar
body: <p>I am trying to customize my search bar like this
  <img src="https://i.stack.imgur.com/CtaBZ.png" alt="enter image description here"></p>
  
  <p>So far I have managed to do upto this</p>
  
  <p><img src="https://i.stack.imgur.com/466Xu.png" alt="enter image description here">
  Now I need to know how to add image on right side, shaping the corners and changing background to an image. This is my code so far. I can do this with help of UITextField but I want to do this using the UISearchBar. Any help??</p>
  
  <pre><code>   - (void)setSearchIconToFavicon 
      {  
          // commented are the things I tried out 
          UITextField *searchField = nil;  
          for (UIView *subview in searchBar.subviews)
          {    
              if ([subview isKindOfClass:[UITextField class]]) 
              {      
                  searchField = (UITextField *)subview;      
                  break;    
              }  
          }    
          if (searchField) 
          {      
              UIImage *image = [UIImage imageNamed: @"search_btn.png"];   
              UIImageView *iView = [[UIImageView alloc] initWithImage:image]; 
              //UIImage *image2 = [UIImage imageNamed: @"search_next_btn.png"];   
              //UIImageView *iView2 = [[UIImageView alloc] initWithImage:image2];  
              searchField.leftView = iView;    
              //searchField.rightView=iView2;
              [[self.searchBar.subviews objectAtIndex:0] removeFromSuperview];
              searchField.textColor = [UIColor grayColor];
          }  
    }
  </code></pre>