Closed CivelXu closed 5 years ago
if let searchTextField = pySearch.searchBar.value(forKey: "searchField") as? UITextField {
searchTextField.borderStyle = .none
searchTextField.layer.cornerRadius = 4
searchTextField.layer.masksToBounds = true
searchTextField.backgroundColor = AppColors.F2F2F2
searchTextField.font = UIFont.systemFont(ofSize: 15)
if #available(iOS 11, *) {
searchTextField.frame = CGRect(x: 12, y: 8, width: kScreenW() * 0.8, height: 28)
} else {
searchTextField.frame = CGRect(x: 0, y: 8, width: kScreenW() * 0.8, height: 28)
}
let leftView = UIImageView(image: UIImage.init(named: "search"))
leftView.size = CGSize(width: 15, height: 15)
searchTextField.leftView = leftView
pySearch.searchBar.setValue(searchTextField, forKey: "searchField")
}
设置圆角的方式
问题描述
searchBarCornerRadius 设置没有效果
受影响的设备
所有
版本信息
最新版本 Swift项目