繁体   English   中英

如何更改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派生自UINavigationControllerpicker.navigationController? 在上面的代码中总是nil

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM