MonoTouch.Dialog: UISearchBar color

In the March 31st release of MonoTouch.Dialog, we can no longer set the color UISearchBar

as there is a new container object with hardcoded colors.

Is there an easier way to change the color UISearchBar

?

As work I am using this (knowing that UISearchBar is the last added element for 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, ""); 
            }
        }

      

+3


source to share


1 answer


This sounds like a regression of the bad function . IMO the answer is not about a workaround, so much the better: use an earlier version, but find out when / why this happened, and make sure the next releases of MonoTouch do not force this violation on other developers.

The best way to deal with them, since the MonoTouch.Dialog build is open source, is to keep track of the version where it happened. You can see the history from github and then comment out the entry that is causing the problem (for example, this one looks like a candidate - perhaps just because it does too many things in one patch).



So, if revision before that works, you add a comment (at the bottom of the page) about the problem. Anyone following the repository will receive an email.

UPDATE . The patches that introduced the changes have been canceled.

+2


source







All Articles