ios – Learn how to set nav button colours to black in iphone restricted entry library picker?


screenshot picker view

I am having bother customizing the nav button colours in PHPickerViewController when it’s proven with restricted photograph library entry on iOS. The navigation bar buttons (“Cancel” and “Executed”) are showing in white on a white background, which makes them invisible. I would like them to seem in black for higher visibility.

What I’ve tried:

  1. Setting International UINavigationBar Look in AppDelegate:
UINavigationBar.look().tintColor = UIColor.black
let look = UINavigationBarAppearance()
look.configureWithOpaqueBackground()
look.backgroundColor = .white
look.titleTextAttributes = [.foregroundColor: UIColor.black]
look.buttonAppearance.regular.titleTextAttributes = [.foregroundColor: UIColor.black]
look.shadowColor = .clear
UINavigationBar.look().standardAppearance = look
UINavigationBar.look().scrollEdgeAppearance = look
  1. Customizing PHPickerViewController Straight:
@objc func openPHPicker() {
    if #accessible(iOS 14.0, *) {
        var configuration = PHPickerConfiguration()
        configuration.selectionLimit = 4
        configuration.filter = .pictures

        let picker = PHPickerViewController(configuration: configuration)
        picker.navigationController?.navigationBar.tintColor = .black
        picker.navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.black]
        picker.delegate = self
        self.current(picker, animated: true, completion: nil)
    }
}

Regardless of attempting each approaches, the buttons nonetheless seem in white on the restricted entry library view. I’ve observed that different apps (like Instagram) handle to show these buttons in black, so I assume there have to be a approach to implement this styling, however I am unable to determine how.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles