2016-06-02 17 views
0

左のバーアイテムがない場合、ナビゲーションバーにのようなbackBarButtonItemが表示されます。しかし、私はそれのためのフォントを設定するためにとにかく見つけることができません。私を助けてください!事前に多くの感謝!backBarButtonItemのカスタムフォントを設定する方法

+0

あなたは 属性を聞かせ起因テキスト---らbarButtonBackStr = "<戻る" を使用することができます:[文字列:ANYOBJECT] = [NSFontAttributeName :UIFont(名前: "AmericanTypewriter-Bold"、サイズ:18)!] let newBackButton = UIBarButtonItem(タイトル:barButtonBackStr、スタイル:UIBarButtonItemStyle.Plain、ターゲット:self、アクション: "barButtonBack:") newBackButton.setTitleTextAttributes 、forState: .Normal) navigationItem.leftBarButtonItem = newBackButton –

答えて

2

スウィフト:

UIBarButtonItem.appearance().setTitleTextAttributes([NSFontAttributeName: UIFont.fontNamesForFamilyName("Futura-Medium"), NSForegroundColorAttributeName:UIColor.whiteColor()], forState: UIControlState.Normal) 

のObjective-C:

[[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: 
                  [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName, 
                  shadow, NSShadowAttributeName, 
                  [UIFont fontWithName:@"Futura-Medium" size:15.0f], NSFontAttributeName, nil] forState:UIControlStateNormal]; 
+1

この回答をSwiftで提供できますか? –

+0

@ SohilR.Memon実際、私は迅速に働いていません。 –

+1

UIBarButtonItem.appearance()。setTitleTextAttributes([NSFontAttributeName:UIFont.fontNamesForFamilyName( "Futura-Medium")、NSForegroundColorAttributeName:UIColor.whiteColor()]、forState:UIControlState.Normal) –

関連する問題