如何为backBarButtonItem设置自定义字体

时间:2016-06-02 09:35:45

标签: ios swift uinavigationbar

如果没有左栏条款,导航栏会显示backBarButtonItem <Back。但无论如何我都找不到为它设置字体。请帮我!非常感谢提前!

1 个答案:

答案 0 :(得分:2)

夫特:

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

目标-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];