title: Xamarin iOS Hide cancel button from Search Bar
body: <p>I wanted to hide 'cancel' button in my iOS search bar. I have implemented the following custom renderer code but it seems not to to work. If anyone knows solution , please share.</p>
  
  <pre><code>public class iOSSearchBar : SearchBarRenderer 
      {
          protected override void OnElementChanged(ElementChangedEventArgs&lt;SearchBar&gt; args)
          {
              base.OnElementChanged(args);
  
          UISearchBar bar = (UISearchBar)this.Control;
  
          bar.AutocapitalizationType = UITextAutocapitalizationType.None;
          bar.AutocorrectionType = UITextAutocorrectionType.No;
          //bar.BarStyle = UIBarStyle.Default;
          //bar.BarTintColor = UIColor.LightGray;
          //bar.KeyboardType = UIKeyboardType.ASCIICapable;
          bar.SearchBarStyle = UISearchBarStyle.Minimal;
          bar.SetShowsCancelButton(false, false);
          bar.ShowsCancelButton = false;
  }
  }
  </code></pre>
  
  <p>Thanks in advance</p>