我将导航栏标题的字体设置为使用动态类型 即
self.navigationController.navigationBar.titleTextAttributes = @{NSFontAttributeName:[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]};
哪个有效,但后退按钮不采用此字体。 我试过了
[self.navigationItem.backBarButtonItem setTitleTextAttributes:@{NSFontAttributeName:[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]} forState:UIControlStateNormal];
但这还没有奏效。
答案 0 :(得分:2)
看起来唯一的方法是创建一个新的UIBarButtonItem:
UIBarButtonItem *dynamicTypeButton = [[UIBarButtonItem alloc] init];
[dynamicTypeButton setTitleTextAttributes:@{NSFontAttributeName:[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]} forState:UIControlStateNormal];
self.navigationItem.backBarButtonItem = dynamicTypeButton;