Monotouch.Dialog - UISearchBar Tint

2019-08-02 04:51发布

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

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

2条回答
女痞
2楼-- · 2019-08-02 04:55

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;
查看更多
SAY GOODBYE
3楼-- · 2019-08-02 05:16

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;
查看更多
登录 后发表回答