I have View controller with embedded SWRevealViewController I've added code below to disable any interaction while the menu on use.
The viewcontroller is embeded with tableview.
How to make menu disappears when users tap on the view-controller as the slack app "When the menu is on use and you tap on the chat the menu disappears"
class Feed: UIViewController,SWRevealViewControllerDelegate {
@IBOutlet weak var menuButton:UIBarButtonItem!
@IBOutlet weak var menuButton:UIBarButtonItem!
override func viewDidLoad() {
super.viewDidLoad()
if self.revealViewController() != nil {
menuButton.target = self.revealViewController()
menuButton.action = "revealToggle:"
self.revealViewController().delegate = self
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
}
fetchMessages()
}
func revealController(revealController: SWRevealViewController!, willMoveToPosition position: FrontViewPosition)
{
if position == FrontViewPosition.Left // if it not statisfy try this --> if revealController.frontViewPosition == FrontViewPosition.Left
{
self.view.userInteractionEnabled = true
}
else
{
self.view.userInteractionEnabled = false
}
func revealController(revealController: SWRevealViewController!, didMoveToPosition position: FrontViewPosition)
{
if position == FrontViewPosition.Left // if it not statisfy try this --> if revealController.frontViewPosition == FrontViewPosition.Left
{
self.view.userInteractionEnabled = true
}
else
{
self.view.userInteractionEnabled = false
}
}
}