Here is how to animate Tab bar tab switch with a CrossDissolve slide transition in UITabBarViewController!

While searching for answer on web for how to give CurlUp / CrossDissolve / FlipFromRight / FlipFromLeft / CurlDown / FlipFromTop / FlipFromBottom transition effect for UITabBar Tab Switch.

I found out this answer but with bug or black screen when you tap on same tab twice i.e. destination and current tab is same.

So I solve this issue with my logic and additional if and else statement.

So here is final answer without any bug.


Step 01: Add this two classes as Super Class to your UITabBarViewController


UITabBarController, UITabBarControllerDelegate


Step 02: Now add following code to your viewDidLoad Function in your UITabBarViewController


self.delegate = self

So your viewDidLoad function will look something like this:


override func viewDidLoad() {

// Do any additional setup after loading the view.

self.delegate = self;


Step 03: Now add following function to your UITabBarViewController file.


func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
let fromView = selectedViewController?.view
let toView = viewController.view

if fromView !== toView {
    UIView.transition(from: fromView!, to: toView!, duration: 0.5, options: [.transitionCrossDissolve], completion: nil)
} else {

return true

Now hopefully if you have done everything right you should see Tab Bar transition on Tab Bar switch.

Hope it helps,

Thanks & Regards
Mandar Apte

Published by Mandar Apte

Mandar is a Mumbai-based multi-disciplinary designer with UX/UI, Logo, Symbol, and Brand Identity design expertise. He currently runs his Mudrkashar Linguistic Apple iPhone, iPad, and Mac app business in the heart of Mumbai city.

Join the Conversation


  1. Thank you for the guide. I’m new to iOS programming and I put the delegate in all my viewcontroller files and they conflicted with each other.

Leave a comment

Leave a Reply