如何使用 UITabBarController 实现此布局

How can I achieve this layout with a UITabBarController

我正在以编程方式构建 UITabBarController,并且需要按以下方式对齐我的选项卡栏图标/文本。

这可能吗?我不确定应该更改哪些属性?

您可以尝试移动 UITabBarItem

的标题和图片

首先将整个 标题 向左向上移动

然后将图片向右下移动


...请注意,这适用于自定义图像,不适用于 系统项目


现在您可以更懒惰并创建 UITabBar

的自定义子类
class CustomTabBar: UITabBar {
    override func awakeFromNib() {
        items?.forEach {
            [=10=].titlePositionAdjustment = UIOffset(horizontal: -20, vertical: -20)
            [=10=].imageInsets = UIEdgeInsets(top: 3, left: 30, bottom: -3, right: -30)
        }
    }
}