MonoTouch.Dialog:UISearchBar 颜色 [英] MonoTouch.Dialog: UISearchBar Color

查看:24
本文介绍了MonoTouch.Dialog:UISearchBar 颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 3 月 31 日发布的 MonoTouch.Dialog 中,我们现在无法再设置 UISearchBar 的颜色,因为有一个带有硬编码颜色的新容器对象.

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.

有没有更简单的方法来改变 UISearchBar 的颜色?

Is there a simpler way to change the color of the UISearchBar ?

作为一种解决方法,我使用它(知道 UISearchBar 是新类 SearchBarBackgroundView 中最后添加的项目:

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, ""); 
            }
        }

推荐答案

这听起来像是一个糟糕的功能回归.IMO 的答案不是解决方法,最好的方法是:使用较早的修订版,但要找出发生这种情况的时间/原因,并确保 MonoTouch 的下一版本不会将这一重大更改强加给其他开发人员.

This sounds like a bad feature regression. IMO the answer is not about a workaround, the best one would be: use an earlier revision, but finding when/why this occurred and make sure the next releases of MonoTouch does not impose this breaking change to other developers.

处理这些问题的最佳方法,因为 MonoTouch.Dialog 程序集是开源的,是跟踪修订发生的地方.您可以从 github 查看 history 然后评论导致问题的条目(例如这个 one/a> 看起来像一个候选——也许只是因为它在一个补丁中做了太多事情).

The best way to deal with those, since the MonoTouch.Dialog assembly is open source, is to track the revision where it occurred. You can see the history from github and then comment on the entry that cause the issue (e.g. this one looks like a candidate - maybe just because it does too many things in a single patch).

因此,如果在此之前的修订有效,那么您添加有关该问题的评论(页面底部).关注存储库的每个人都会收到一封电子邮件.

So if the revision before this one works then you add a comment (bottom of the page) about the issue. Everyone following the repository will get an email.

更新:引入重大更改的补丁已恢复.

UPDATE: The patches that introduced the breaking changes has been reverted.

这篇关于MonoTouch.Dialog:UISearchBar 颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆