SWRevealViewController
SWRevealViewController copied to clipboard
Hi, How to avoid the swipe to rear view?
I have 1 total of 4 VC(ViewControllers) in my project, for example VC1(homeViewController), VC2(MenuViewControllers), VC3, VC4. When I click Menu button from VC1 then VC2 shows after I am choose navigating to VC3 from VC2(Menu) and back to VC1(home) then goes to VC2(menu) then choose navigating to VC4, So now I am in VC4 here only I face the issue suppose If I drag or swipe the View means its pop(navigate) to VC3 or whatever VC before use the current VC.
Still now not sure of the solution to this issue and the same happens for other Views also please help me for find out the issue.
In fact when you are in VC3 or VC4 you don't want to be able to open the left menu, you want to come back to Home (VC1), right? And you want to be able to open the left menu only from Home (VC1), right?
Yes right this method was I have used.
The deal is to push the vc3 or vc4 the front view navigation controller and reveal (or push) the home view controller. I'll write a sample.
This code was I used for to move other view controller from menu..
let mainstoryboard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let InformationVC = mainstoryboard.instantiateViewController(withIdentifier: "InformationViewController") as! InformationViewController let FrontController = UINavigationController.init(rootViewController: InformationVC) revealviewcontroller.pushFrontViewController(FrontController, animated: true)
And this code was I used for back to Home View Controller(VC1)..
let nav = storyboard?.instantiateViewController(withIdentifier: "HomeNavigationController") as! UINavigationController let menuTableVC = storyboard?.instantiateViewController(withIdentifier: "LeftMenuViewController") as? LeftMenuViewController let mainRevealController = SWRevealViewController(rearViewController: menuTableVC, frontViewController: nav) navigationController?.pushViewController(mainRevealController!, animated: true) self.navigationController?.navigationBar.isHidden = true
Thanks..
Can you Please write including this functionality in sample, how navigate to other viewcontroller from Menu and how to back to Homeviewcontroller(VC1) from other viewcontroller..
I wrote this sample:
If you want a navigation bar with a title on left menu, just check Shows Navigation Bar in Navigation controller scene in storyboard.
Hope it helps!
Ok thanks I will check it now.
Very Very Thanks its helpful for me.
One More doubt I have, Can I ask Now?
When I use Segue for Navigating Menu Button not works, for example In HomeViewController(VC1) at first time I open menu via menu button then choose HomeViewController option from menu so it directs to HomeViewController but this time I unable to open Menu because Menu button not works.
How to fix the Current issue?
Not sure to understand. Do you instantiate HomeViewController each time? Don't use segue for that, save the reference of your HomeViewController as in the sample.
ok Thanks..