UINavigationBar set custom shadow in AppDelegate.swift

前端 未结 2 2012
庸人自扰
庸人自扰 2021-01-13 02:24

I want to set some shadow to the bottom of my UINavigationBar for the whole application. Here is what I\'ve tried but it doesn\'t work:

func application(appl         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-13 02:37

    Easy, works on Swift 3:

        navigationController?.navigationBar.layer.shadowColor = UIColor.black.cgColor
        navigationController?.navigationBar.layer.shadowOpacity = 1
        navigationController?.navigationBar.layer.shadowOffset = CGSize.zero
        navigationController?.navigationBar.layer.shadowRadius = 10
    

提交回复
热议问题