iOS tab bar while select one tab then not select the tab aslo slide the side menu swift

Problem:

I want to create a tab bar controller with four tabs.Then after if user tabs on 4th tab then i want to open the menu also not to show the 4th tab.Instead of show the menu and previous selected as same.

Solution:

Add the delegate function

 func tabBarController(_ tabBarController: UITabBarControllershouldSelect viewController: UIViewController) -> Bool {

        if viewController is someVC {

            menushow(titleButton)

                   return false // Do not switch to the side menu as a tab bar item

               }

               return true

    }


Also add the delegate as like below

class myVC:UITabBarController,UITabBarControllerDelegate{


}


In viewdidload also set the delegate

self.delegate = self

Happy coding.....

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift