|
@@ -149,7 +149,7 @@ extension TSTabBarController {
|
|
|
if show {
|
|
|
addRedDotToLastTab()
|
|
|
} else {
|
|
|
- appUpdateDotView.removeFromSuperview()
|
|
|
+ appUpdateDotView.isHidden = true
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -157,14 +157,21 @@ extension TSTabBarController {
|
|
|
guard let items = tabBar.items,
|
|
|
!items.isEmpty else { return }
|
|
|
|
|
|
- appUpdateDotView.removeFromSuperview()
|
|
|
+ if appUpdateDotView.superview != nil {
|
|
|
+ appUpdateDotView.isHidden = false
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
let lastItemIndex = items.count - 1
|
|
|
let itemWidth = tabBar.frame.width / CGFloat(items.count)
|
|
|
let xPosition = itemWidth * CGFloat(lastItemIndex) + itemWidth/2 + (dotSize * 2) + 2
|
|
|
let yPosition: CGFloat = 10
|
|
|
- appUpdateDotView.frame = CGRect(x: xPosition, y: yPosition, width: dotSize, height: dotSize)
|
|
|
tabBar.addSubview(appUpdateDotView)
|
|
|
+ appUpdateDotView.snp.makeConstraints { make in
|
|
|
+ make.width.height.equalTo(dotSize)
|
|
|
+ make.leading.equalTo(xPosition)
|
|
|
+ make.top.equalTo(yPosition)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func changeSelectedIndex(index:Int){
|