gpt4 book ai didi

iOS:后退按钮标签被自定义字体截断

转载 作者:行者123 更新时间:2023-11-30 11:30:20 25 4
gpt4 key购买 nike

我正在为导航项使用自定义字体;当我转向另一个 View Controller 时,新呈现的 View Controller 上的后退按钮在左侧被切断。在执行 segue 之前,我在第一个 View Controller 上尝试了 setTitlePositionAdjustment(_ adjustment: UIOffset, for barMetrics: UIBarMetrics) 但它没有取代按钮: enter image description here

还有

enter image description here

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "Show Contents" {
if let viewController = segue.destination as? ContentsTableViewController {
viewController.navigationItem.backBarButtonItem?.setTitlePositionAdjustment(UIOffsetMake(10, 0), for: .default)

}
}
}

最佳答案

使用此代码:

override func viewDidLoad() {
super.viewDidLoad()
let backBarButtonItem = UIBarButtonItem(title: "خانه", style: .plain, target: nil, action: nil)
backBarButtonItem.setTitleTextAttributes([.font : UIFont(name: "B Koodak", size: 32)!], for: .normal)
navigationItem.backBarButtonItem = backBarButtonItem
}

我得到以下信息:enter image description here

关于iOS:后退按钮标签被自定义字体截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50328432/

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