In the March 31 release of MonoTouch.Dialog we aren't able to set the color of the UISearchBar
anymore now as there is a new container object with hard coded colors.
Is there a simpler way to change the color of the UISearchBar
?
As a work around, I use this (knowing that the UISearchBar is the last added item to the new class SearchBarBackgroundView
:
SearchBarBackgroundView sb = TableView.TableHeaderView as SearchBarBackgroundView;
if (sb != null)
{
try
{
if (sb.Subviews.Count () > 1)
{
UISearchBar bar = sb.Subviews [sb.Subviews.Count () - 1] as UISearchBar;
if (bar != null)
{
bar.BackgroundColor = Settings.AppTintColor;
bar.TintColor = Settings.AppTintColor;
}
}
}
catch (Exception e)
{
ExceptionPublisher.Pub (e, "");
}
}