swift 修改UISearchBar输入框背景颜色

修改UISearchBar输入框背景颜色

        if #available(iOS 13.0, *) {
            seachBar.searchTextField.font = kSetPingFangRegular(12)
            seachBar.searchTextField.backgroundColor = .red
        } else {
            
            // 修改搜索框背景
            if let textfiled = seachBar.subviews.first?.subviews.last?.subviews.first as? UITextField {
                textfiled.backgroundColor = .white
                textfiled.font = kSetPingFangRegular(12)
            }
        }

你可能感兴趣的:(swift,ios,ios,swift)