UISearchBar输入框颜色设置,文字颜色设置

来源:互联网 发布:淘宝买家改评价的链接 编辑:程序博客网 时间:2024/06/06 15:03

//输入框背景颜色设置

UIView *searchTextField = [[[self.searchBar.subviewsfirstObject]subviews]lastObject];

    searchTextField.backgroundColor = [UIColorcolorWithHexString:@"#1c232c"withAlpha:1];


//文字颜色设置

for (UIView *subViewin self.searchBar.subviews)

    {

       for (UIView *secondLevelSubviewin subView.subviews){

           if ([secondLevelSubview isKindOfClass:[UITextField class]])

            {

               UITextField *searchBarTextField = (UITextField *)secondLevelSubview;

                //set font color here

                searchBarTextField.textColor = [UIColorcolorWithHexString:@"#676f7d"withAlpha:1];

               break;

            }

        }

    }


0 0