I have been developing ios using swift for 3 months.I am just little bit curious about interesting animations.I have been using application and this application has interesting tab bar item .This bar item changed itself every 3 seconds .How can ı code that?? First Second Third. Thank for eveything
There is a simpler way to doing this. Add the following code in the tabbar delegate:
class MySubclassedTabBarController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
delegate = self
}
}
extension MySubclassedTabBarController: UITabBarControllerDelegate {
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
guard let fromView = selectedViewController?.view, let toView = viewController.view else {
return false // Make sure you want this as false
}
if fromView != toView {
UIView.transition(from: fromView, to: toView, duration: 0.3, options: [.transitionCrossDissolve], completion: nil)
}
return true
}
}