self.navigationController?.navigationBar.shadowImage = UIImage()// 底部横线就没有了
self.navigationController?.navigationBar.shadowImage = nil // 这句代码就可以让消失的底部横线重新出现
根据官方文档的说法,我们就很好理解了,所以这应该是去掉横线最简单的办法。
/* Default is nil. When non-nil, a custom shadow image to show instead of the default shadow image. For a custom shadow to be shown, a custom background image must also be set with -setBackgroundImage:forBarMetrics: (if the default background image is used, the default shadow image will be used).
*/