我的疑问很简单,有可能修改一个tabBarItem的y cordenada吗?
我需要这个,因为我想从右到左对齐所有TabBarItens,因为我的应用程序将在横向模式下工作。
我想要这样的事情:Align icons TabBar
答案 0 :(得分:0)
在YourTabBarButton类中执行此操作:
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
}
}