Monotouch.Dialog - UISearchBar Tint

我怕爱的太早我们不能终老 提交于 2019-12-11 10:06:22

问题


When I enable the Search bar on a DialogViewController, how is the searchbar's tint changed?

        EnableSearch = true;
        SearchPlaceholder = "Find station";
        AutoHideSearch = false;

回答1:


The searchbar in MonoTouch.Dialog is private, you would need to modify your source code to change the TintColor when the searchBar is instantiated.

Another option suggested in the comments is to use:

((UISearchBar) TableView.TableHeaderView).TintColor = UIColor.Black;



回答2:


Taking Miguel's help, I found that the TableHeaderView containers the SearchBar so I could do this to change the tint after the searchBar is instantiated (thanks):

UISearchBar sb = TableView.TableHeaderView as UISearchBar;
if(sb!=null)
   sb.TintColor = UIColor.Black;


来源:https://stackoverflow.com/questions/8622200/monotouch-dialog-uisearchbar-tint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!