I want to change the background color of PHPicker's navigationbar in iOS15.
↓This answer did not work in PHPicker
https://developer.apple.com/forums/thread/682420
How to customize?
I want to change the background color of PHPicker's navigationbar in iOS15.
↓This answer did not work in PHPicker
https://developer.apple.com/forums/thread/682420
How to customize?
PHPicker is out of process and currently doesn't support any UI customization, other than inheriting your application's tint color.
We recommend just using the default system picker UI. Most users already used PHPicker in other apps, and familiarity could help them trusting your app.
However, please submit an enhancement request via the Feedback app, if you think your app needs specific customization options.
Thank you for your answer !
Hang on a minute. Why would the PHPicker inherit my applications tint color if it is not going to inherit anything else? My tint color is white because my navigation bar color is blue. So, now I have a PHPicker with white buttons and a white background (really it is light blue because the PHPicker did actually also inherit the UINavigationBar.appearance.backgroundColor, but did not inherit the opaque setting), and this is impossible to read. Since I used the appearance API, the only way to undo this is to reset the global appearance when the PHPicker is shown, and reset it when it is dismissed which seems completely counterintuitive to setting one appearance for the entire app. Please explain to me why the PHPicker takes one color from our app, and not the rest, instead of taking none and looking like a system dialog, or taking all of them.
I would also like to hear the answer to @barela's question. I have the same problem and I can't find any solution to this
PHPicker is out of process and currently doesn't support any UI customization, other than inheriting your application's tint color.
We recommend just using the default system picker UI. Most users already used PHPicker in other apps, and familiarity could help them trusting your app.
However, please submit an enhancement request via the Feedback app, if you think your app needs specific customization options.
Thank you for your answer !
Hang on a minute. Why would the PHPicker inherit my applications tint color if it is not going to inherit anything else? My tint color is white because my navigation bar color is blue. So, now I have a PHPicker with white buttons and a white background (really it is light blue because the PHPicker did actually also inherit the UINavigationBar.appearance.backgroundColor, but did not inherit the opaque setting), and this is impossible to read. Since I used the appearance API, the only way to undo this is to reset the global appearance when the PHPicker is shown, and reset it when it is dismissed which seems completely counterintuitive to setting one appearance for the entire app. Please explain to me why the PHPicker takes one color from our app, and not the rest, instead of taking none and looking like a system dialog, or taking all of them.
I would also like to hear the answer to @barela's question. I have the same problem and I can't find any solution to this
I encountered the same problem. I applied the accentColor modifier of the view to change colour.
//SwiftuiView.swift
PhotoPicker(isPresented: $addImages)
.accentColor(.indigo)
//PhotoPicker.swift
struct PhotoPicker: UIViewControllerRepresentable {
@Binding var isPresented: Bool
func makeUIViewController(context: Context) -> some UIViewController {
var configuration = PHPickerConfiguration()
configuration.filter = .images // filter only to images
configuration.selectionLimit = 5 // ignore limit
let photoPickerViewController = PHPickerViewController(configuration: configuration)
photoPickerViewController.delegate = context.coordinator
return photoPickerViewController
}
func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { }
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
class Coordinator: PHPickerViewControllerDelegate {
private let parent: PhotoPicker
init(_ parent: PhotoPicker) {
self.parent = parent
}
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
parent.isPresented = false
}
}
}
I encounter the same problem. After a few days of research i found the following with which i was able to give the Navigationbar in the limited PHPicker my desired background color. But it didn´t fully work, because i have to click the Searchbar so that it accepts the color of the Navigationbar. In addition, the whole Navigationbar is still transparent even though i´ve set
appearance.configureWithDefaultBackground()
, which in my understanding is neither transparent nor translucent. When trying to set any color for the UIButton´s it won´t work as well.I found it here: https://stackoverflow.com/questions/69796381/incorrect-navigation-bar-colour-in-limited-library-picker-on-ios-15
Some help here is really appreciated and for sake of completion i also used the methods of this thread: https://developer.apple.com/forums/thread/682420