/ / links und rechts BarButtons Schrift in UIImagePickerController - ios, swift, uiimagepickercontroller, uibarbuttonitem

links und rechts BarButtons Schrift in UIImagePickerController - ios, swift, uiimagepickercontroller, uibarbuttonitem

Wie kann man die benutzerdefinierte Schriftart auf die linken und rechten UIBarButtons des UIImagePickerControllers setzen?

Ich habe diesen Code ausprobiert, aber es funktioniert nicht:

let imagePicker = UIImagePickerController()
imagePicker.navigationBar.barTintColor = UIColor(hex: 0x212121)
imagePicker.navigationBar.translucent = false
imagePicker.navigationBar.tintColor = UIColor.whiteColor()
imagePicker.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor(), NSFontAttributeName: UIFont(name: "Roboto-Regular", size: 20.0)!]

// doesn"t work
imagePicker.navigationItem.backBarButtonItem?.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.whiteColor(), NSFontAttributeName: UIFont(name: "Roboto-Regular", size: 25.0)!], forState: UIControlState.Normal)
imagePicker.navigationItem.leftBarButtonItem?.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.whiteColor(), NSFontAttributeName: UIFont(name: "Roboto-Regular", size: 20.0)!], forState: UIControlState.Normal)
imagePicker.navigationItem.rightBarButtonItem?.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.whiteColor(), NSFontAttributeName: UIFont(name: "Roboto-Regular", size: 20.0)!], forState: UIControlState.Normal)

Antworten:

0 für die Antwort № 1

Sie müssen UIImagePickerController ableiten und Ihre eigene Symbolleiste einstellen.

Es gibt ein großartiges Beispiel von Apple: https://developer.apple.com/library/ios/samplecode/PhotoPicker/Introduction/Intro.html

Es ist in Ziel-C, aber ich bin sicher, es wird Ihnen eine Vorstellung davon geben, was Sie tun müssen.