如何更改 UIImagePickerController 导航栏字体?

How can I change UIImagePickerController navigation bar font?

我需要它是 Helvetica Neue Light。这是我创建控制器的方法

let picker: UIImagePickerController = UIImagePickerController()
picker.delegate = self
picker.allowsEditing = false
picker.navigationBar.tintColor = UIColor.whiteColor()
picker.sourceType = .PhotoLibrary
picker.navigationController?.navigationBar.tintColor = UIColor.blueColor()

self.presentViewController(picker, animated: true, completion: { _ in })

你是这样做的:

picker.navigationBar.titleTextAttributes =
    [NSForegroundColorAttributeName: UIColor.redColor(),
        NSFontAttributeName: UIFont.init(name: "Helvetica", size: 21)!]

此外,您的代码有一个小问题:UIImagePickerController 派生自 UINavigationController,并且 picker.navigationController? 在您上面的代码中始终是 nil