John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 989 forks source link

Hi, How to avoid the swipe to rear view? #721

Open Saravana181187 opened 7 years ago

Saravana181187 commented 7 years ago

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.

iDevelopper commented 7 years ago

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?

Saravana181187 commented 7 years ago

Yes right this method was I have used.

iDevelopper commented 7 years ago

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.

Saravana181187 commented 7 years ago

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..

Saravana181187 commented 7 years ago

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..

iDevelopper commented 7 years ago

I wrote this sample:

SWHomePushSwift.zip

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!

Saravana181187 commented 7 years ago

Ok thanks I will check it now.

Saravana181187 commented 7 years ago

Very Very Thanks its helpful for me.

Saravana181187 commented 7 years ago

One More doubt I have, Can I ask Now?

Saravana181187 commented 7 years ago

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?

iDevelopper commented 7 years ago

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.

Saravana181187 commented 7 years ago

ok Thanks..