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: UITabBarController, shouldSelect 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,UI
}
In viewdidload also set the delegate
self.delegate = self
Happy coding.....
Comments
Post a Comment