Reputation: 1
I am working on a project that I want to incorporate SWRevealViewController with. I was able to get my slide in menu showing with it showing when clicking on the menu button with code below:
if self.revealViewController() != nil {
menuButton.target = self.revealViewController()
menuButton.action = "revealToggle:"
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
}
but I am now trying to do the same thing, but from a UITabBarItem when clicked. I don't have any code written yet, but I am just asking how I can go about doing this.
Here are the images to show what I want to accomplish. Thank you!
Upvotes: 0
Views: 276
Reputation: 347
This is how you do it. It works for me.
class ViewController: UITabBarDelegate {
@IBOutlet weak var tabBar: UITabBar!
override func viewDidLoad() {
tabBar.delegate = self
}
func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
if(item.tag == 0){
self.revealViewController().revealToggle(self)
}
}
Upvotes: 0