最佳答案
您可以尝试移动 UITabBarItem
的标题和图像
开始将整个标题向左和向上移动
然后将图片向右和向下移动
...请注意,这适用于自定义图像,不适用于系统项目
现在您可以更懒惰并创建 UITabBar
的自定义子类
class CustomTabBar: UITabBar {
override func awakeFromNib() {
items?.forEach {
$0.titlePositionAdjustment = UIOffset(horizontal: -20, vertical: -20)
$0.imageInsets = UIEdgeInsets(top: 3, left: 30, bottom: -3, right: -30)
}
}
}
关于swift - 如何使用 UITabBarController 实现此布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54052253/