UISearchController修改搜索框颜色

2017-04-09  本文已影响257人  Freedom_fly

创建searchcontroller的方法就不多说了,说一下修改对应搜索框的颜色:

self.memberSearchVC.searchBar.barTintColor = [UIColor whiteColor]; // searchBar整个的背景色
    for (UIView *subview in [[self.memberSearchVC.searchBar.subviews lastObject] subviews]) {
        
        if ([subview isKindOfClass:[UITextField class]]) {
            
            UITextField *textField = (UITextField*)subview;
            // 搜索框里面的颜色
            textField.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1/1.0];
            
        }
    }
上一篇下一篇

猜你喜欢

热点阅读