Ipad 更改UITABBARIEM的y位置

Ipad 更改UITABBARIEM的y位置,ipad,uitabbarcontroller,uitabbaritem,Ipad,Uitabbarcontroller,Uitabbaritem,我的疑问很简单,是否有可能修改y cordenada a tabBarItem 我需要这个,因为我想从右到左对齐所有TabBarItens,因为我的应用程序将在横向模式下工作 我想要这样的东西:在TabbarButton类中执行此操作: public class YourTabBarItem: UITabBarItem { @IBInspectable public var tintColor: UIColor? @IBInspectable public var rightTo

我的疑问很简单,是否有可能修改y cordenada a tabBarItem

我需要这个,因为我想从右到左对齐所有TabBarItens,因为我的应用程序将在横向模式下工作


我想要这样的东西:

在TabbarButton类中执行此操作:

public class YourTabBarItem: UITabBarItem {
    @IBInspectable public var tintColor: UIColor?
    @IBInspectable public var rightToLeft:Bool = false
}

public class YourTabBarButton: UIControl {
    override public func layoutSubviews() {
            super.layoutSubviews()
            tabBg.layer.cornerRadius = tabBg.bounds.height / 2.0
            let offset = CGFloat(6)
            tabBg.layer.frame.size.width = tabBg.layer.frame.size.width - 2 * offset
            tabBg.frame.origin.y = tabBg.frame.origin.y - offset
            tabBg.frame.origin.x = tabBg.frame.origin.x + offset
            tabLabel.frame.origin.y = tabLabel.frame.origin.y - offset
            tabImage.frame.origin.y = tabImage.frame.origin.y - offset
        }
}