简体   繁体   中英

How to remove bottom shadow for navigationBar in swift3

我尝试将图像设置为空,但无法正常工作

navigationController?.navigationBar.shadowImage = UIImage()

setting background image & shadow images working for me. Thanks @xingou

navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationController?.navigationBar.shadowImage = UIImage()

this is what the API document said :

The default value is nil, which corresponds to the default shadow image. When non-nil, this property represents a custom shadow image to show instead of the default. To show a custom shadow image, you must also set a custom background image with the setBackgroundImage(_:for:) method. If the default background image is used, then the default shadow image is used regardless of the value of this property.

so you need set the backgroundimage first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM