gpt4 book ai didi

iOS - UIBarButtonItem - 后退按钮标题垂直位置不调整

转载 作者:IT王子 更新时间:2023-10-29 08:13:15 24 4
gpt4 key购买 nike

我正在使用 UIAppearance 在我的 UIBarButtonItem 对象中设置自定义字体。这工作正常并正确设置字体。但是,我确实需要调整按钮标题的垂直位置以适应新字体的大小。

[[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIFont fontWithName:@"Sketch Rockwell" size:12] forKey:UITextAttributeFont] forState:UIControlStateNormal];
[[UIBarButtonItem appearance] setTitlePositionAdjustment:UIOffsetMake(0, 1.5) forBarMetrics:UIBarMetricsDefault];

问题是在常规 UIBarButtonItem 中正确调整了标题的垂直位置,但导航栏上的后退按钮没有得到调整。我假设我在我的代码中以正确的对象为目标,因为它的字体得到了更新,而不是它的标题的垂直位置。

有没有人知道如何直接定位后退按钮?

谢谢

布莱恩

最佳答案

我也遇到了这个问题,我通过以下方法修复了它:

[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, 1.5) forBarMetrics:UIBarMetricsDefault];

关于iOS - UIBarButtonItem - 后退按钮标题垂直位置不调整,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10233028/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com