gpt4 book ai didi

ipad - 更改 UITabBarItem 的 y 位置

转载 作者:行者123 更新时间:2023-12-03 22:13:14 25 4
gpt4 key购买 nike

好吧,我的疑问很简单,是否有可能将 ycordenada 修改为 tabBarItem?

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

我想要这样的东西:Align icons TabBar

最佳答案

在 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
}
}

关于ipad - 更改 UITabBarItem 的 y 位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9807086/

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