ios - UISearchBar输入框背景色

  1.    //输入框背景色

        bar.searchBarStyle = UISearchBarStyleMinimal;

        [bar positionAdjustmentForSearchBarIcon:UISearchBarIconSearch];

        

        // 改变UISearchBar内部输入框样式

        UIView *searchTextField = nil;

        searchTextField = [[[bar.subviews firstObject] subviews] lastObject];

        // 改变输入框背景色

        searchTextField.subviews[0].backgroundColor = [UIColor purpleColor];

    //    searchTextField.layer.cornerRadius = 5.0;

        

posted @ 2017-11-27 17:12  神来钥匙-陈诗友  阅读(557)  评论(0)    收藏  举报