自己写 UISearchBar 发现有一个阴影如下
链接如下stackoverflow 地址
let searchView = UISearchBar.init(frame: CGRect.init(x: 8, y: 26, width: ScreenWidth - 16 - 44, height: 30))
navigationView.addSubview(searchView)
for subView in searchView.subviews {
for view in subView.subviews {
if view.isKind(of:NSClassFromString("UISearchBarBackground")!) {
let imageView = view as! UIImageView
imageView.removeFromSuperview()
}
}
}
最后解决如下