How do you color/customize the UIImagePickerController's Navigation Bar?
Updated for Swift 4.2
For completeness, I'll add full color customization setup:
let imagePicker = UIImagePickerController()imagePicker.navigationBar.isTranslucent = falseimagePicker.navigationBar.barTintColor = .blue // Background colorimagePicker.navigationBar.tintColor = .white // Cancel button ~ any UITabBarButton itemsimagePicker.navigationBar.titleTextAttributes = [ NSAttributedString.Key.foregroundColor: UIColor.white] // Title color
which results in:
Try:
picker.navigationBar.translucent = falsepicker.navigationBar.barTintColor = .redColor()
Instead of
picker.navigationBar.backgroundColor = UIColor.redColor()
If you want translucent effects, leave translucent = true
as default.
Here the right solution code in Objective-C. Might be useful.
imagePickerController.navigationBar.translucent = NO;imagePickerController.navigationBar.barTintColor = [UIColor colorWithRed:0.147 green:0.413 blue:0.737 alpha:1];imagePickerController.navigationBar.tintColor = [UIColor whiteColor];imagePickerController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]};