Avatar ·

How to remove the bottom line (1px) from UINavigationBar in iOS

Hello everyone! I'm a beginner in iOS development and I've run into this problem: when creating a custom app design, I need to remove the standard gray line at the bottom of UINavigationBar (the one that is 1 pixel thick). I'm using Swift, targeting iOS 14+.\n\nI've tried several methods from the internet, but none of them worked completely. I tried setting `shadowImage` to an empty UIImage, but that didn't help. I also tried changing `backgroundImage` for `barMetrics`, but the line still remained. Here's my current code that doesn't work:\n\n```swift\n// In viewDidLoad\nnavigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)\nnavigationController?.navigationBar.shadowImage = UIImage()\nnavigationController?.navigationBar.isTranslucent = false\n```\n\nI'm using UINa