2016-03-06 106 views
3

我需要它成爲Helvetica Neue Light。這裏是我創建控制器如何更改UIImagePickerController導航欄字體?

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 }) 
+1

你試過設置'picker.navigationBar.titleTextAttributes'嗎? –

回答

2

這是你如何做到這一點:

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

而且,一個小問題,你的代碼:UIImagePickerControllerUINavigationController導出,picker.navigationController?總是nil在你的代碼以上。

+0

您是否知道如何通過我的代碼訪問庫後退按鈕 – ConnorB

+0

我需要將其更改爲後退箭頭 – ConnorB

+0

@ConnorB,據我所知,沒有明確的方法將bar按鈕更改爲後退按鈕左箭頭,如果這是你要求的。如果使用導航控制器並將新視圖控制器推送到導航堆棧,則後退按鈕會自動添加。 –