0

I’m working on a iOS-App based on Xcode’s “Master-Detail Template” and want to use custom colors for some of the UI elements.

However, I couldn’t find out how to change the right separator of the UINavigationBar:

enter image description here

I’ve already tried to change the backgroundColor of UINavigationBar, UINavigationItem and its titleView but without success.

Would be great if someone has a clue.

EDIT: I’ve just noted that viewed in vertical mode, it’s the whole separator that I want to ink?

enter image description here

ixany
  • 5,433
  • 9
  • 41
  • 65

1 Answers1

0

A slight modification of this answer gives you

extension UINavigationBar {

    func setRightBorderColor(color: UIColor, width: CGFloat) {
        let rightBorderRect = CGRect(x: frame.width, y: 0, width: width, height: frame.height)
        let rightBorderView = UIView(frame: rightBorderRect)
        rightBorderView.backgroundColor = color
        addSubview(rightBorderView)
    }
}
Michael
  • 657
  • 5
  • 22
  • Thanks for asking – glad you’re trying to help. It did not work. Since I’ve noticed that the whole separator is bright colored if I rotate the iPad (see the edit of my original question), I think that its **not** just the `UINavigationBar` that I want to ink. However, your approach to add a new layer above another one doesn’t seem right for me. – ixany May 24 '18 at 16:58