index当前点击的是哪个item
extension UITabBar {
func reloadLayout(index: Int) {
var temp: UIView?
for button in subviews {
for sub in button.subviews {
if NSStringFromClass(sub.classForCoder) == "_UIBadgeView" {
temp = sub
break
}
}
}
guard let badgeView = temp else {
return
}
badgeView.layer.transform = CATransform3DIdentity
badgeView.layer.transform = index == 2 ? CATransform3DMakeTranslation(1, -13, 1) : CATransform3DMakeTranslation(1, 1, 1)
}
}
网友评论