Comments (1)
Replace following code
override public func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
if let uSelf = self.tabBar as? SSCustomTabBar, let items = uSelf.items, let index = items.firstIndex(of: item), index != self.priviousSelectedIndex {
let width = UIScreen.main.bounds.width/CGFloat(items.count)
var changedIndex = 0
if NSLocale.preferredLanguages[0].starts(with: "ar") {
if index == 0 {
changedIndex = 5
} else if index == 1 {
changedIndex = 4
} else if index == 2 {
changedIndex = 3
} else if index == 3 {
changedIndex = 2
} else if index == 4 {
changedIndex = 1
}
} else {
changedIndex = index + 1
}
let changeValue = (width*CGFloat(changedIndex))-(width/2)
uSelf.animating = true
let orderedTabBarItemViews: [UIView] = {
let interactionViews = tabBar.subviews.filter({ $0 is UIControl })
return interactionViews.sorted(by: { $0.frame.minX < $1.frame.minX })
}()
orderedTabBarItemViews.forEach({ (objectView) in
let objectIndex = orderedTabBarItemViews.firstIndex(of: objectView)
if index == objectIndex {
print(index)
}else if objectIndex == priviousSelectedIndex {
UIView.animate(withDuration: 0.9, delay: 0.0, usingSpringWithDamping: 0.57, initialSpringVelocity: 0.0, options: .curveEaseInOut, animations: {
objectView.frame = CGRect(x: objectView.frame.origin.x, y: objectView.frame.origin.y + self.kUpAnimationPoint, width: objectView.frame.width, height: objectView.frame.height)
}, completion: nil)
}
})
self.priviousSelectedIndex = index
performSpringAnimation(for: orderedTabBarItemViews[index], changeValue: changeValue)
}
}
from sscustomtabbar.
Related Issues (17)
- Hello, is there any Android? HOT 1
- Unable to set the default chosen tab. HOT 3
- How to Use in iPAD HOT 2
- is it support in lanscape ipad and iphone ? HOT 3
- Issue with first tab bar button HOT 1
- Issue with tab bar icon HOT 4
- Can you display badge on tab items? HOT 1
- RTL support ? HOT 3
- Enable subclassing SSCustomTabViewController HOT 2
- Swift code usage HOT 5
- unable to open file (in target "SSCustomTabbar_Tests" ) HOT 1
- How to change Wave height in SwiftUI
- push pop bug HOT 5
- Unable to set shadow to Tab bar HOT 2
- wave doesn't move if you change tabs programatically HOT 3
- How can i stop displaying Tabbar Item? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sscustomtabbar.