/ / ľavý a pravý barButtons písmo v UIImagePickerController - ios, swift, uiimagepickercontroller, uibarbuttonitem

ľavé a pravé písmo barButtons v UIImagePickerController - ios, swift, uiimagepickercontroller, uibarbuttonitem

Aký je spôsob, ako nastaviť vlastné písmo do ľavého a pravého UIBarButtons UIImagePickerController?

Skúšal som tento kód, ale to nefunguje:

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)

odpovede:

0 pre odpoveď č. 1

budete potrebovať podtriedu UIImagePickerController a nastaviť si vlastnú lištu nástrojov.

Je to skvelý príklad z jablka: https://developer.apple.com/library/ios/samplecode/PhotoPicker/Introduction/Intro.html

Je to v objekte-C, ale som si istý, že vám dá predstavu o tom, čo potrebujete urobiť.