Я хочу добавить изображение на панели навигации для UIDocumentPicker
.
Я пробовал использовать следующий код:
var documentPicker = UIDocumentPickerViewController(documentTypes: ["com.adobe.pdf","com.apple.rtfd"], in: .import)
iewController.navigationItem.hidesBackButton = false;
documentPicker.navigationItem.leftBarButtonItem?.tintColor = ConfigurationParameters.textColor
documentPicker.navigationController?.navigationBar.isTranslucent = false
documentPicker.navigationController?.navigationBar.tintColor = UIColor.black
documentPicker.navigationItem.titleView?.backgroundColor = UIColor.white
let bannerHeight = documentPicker.navigationController?.navigationBar.frame.height
print(viewController.navigationController?.navigationBar.frame.height)
let logoContainer = UIView(frame: CGRect(x: 0, y: 0, width: 200, height: bannerHeight ?? 44.0 * 1.0))
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 200, height: bannerHeight ?? 44.0 * 1.0))
let logo = UIImage(named: "Resource.bundle/xyz.me", in: Bundle(for: ViewController.self), compatibleWith: nil)
imageView.image = logo
imageView.contentMode = .scaleAspectFill
logoContainer.addSubview(imageView)
documentPicker.navigationItem.titleView = logoContainer