alexxjk alexxjk - 8 months ago 46
Swift Question

How to add shadow to Navigation Bar instead of default border

I want to replace a default border in

with shadow. Is there any way to achieve this? I have tried using the same approach as with adding shadow to UIView but it increases a height of my NavigationBar.


try this

self.navigationController.navigationBar.layer.shadowColor = UIColor.blackColor().CGColor
self.navigationController.navigationBar.layer.shadowOffset = CGSizeMake(2.0, 2.0)
self.navigationController.navigationBar.layer.shadowRadius = 4.0
self.navigationController.navigationBar.layer.shadowOpacity = 1.0