SWRevealViewController icon indicating copy to clipboard operation
SWRevealViewController copied to clipboard

Hi, How to avoid the swipe to rear view?

Open Saravana181187 opened this issue 7 years ago • 12 comments

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.

Saravana181187 avatar Aug 08 '17 14:08 Saravana181187

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?

iDevelopper avatar Aug 09 '17 05:08 iDevelopper

Yes right this method was I have used.

Saravana181187 avatar Aug 09 '17 09:08 Saravana181187

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.

iDevelopper avatar Aug 09 '17 09:08 iDevelopper

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 avatar Aug 09 '17 09:08 Saravana181187

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

Saravana181187 avatar Aug 09 '17 09:08 Saravana181187

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!

iDevelopper avatar Aug 09 '17 10:08 iDevelopper

Ok thanks I will check it now.

Saravana181187 avatar Aug 09 '17 10:08 Saravana181187

Very Very Thanks its helpful for me.

Saravana181187 avatar Aug 09 '17 10:08 Saravana181187

One More doubt I have, Can I ask Now?

Saravana181187 avatar Aug 09 '17 11:08 Saravana181187

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?

Saravana181187 avatar Aug 09 '17 11:08 Saravana181187

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.

iDevelopper avatar Aug 09 '17 11:08 iDevelopper

ok Thanks..

Saravana181187 avatar Aug 09 '17 12:08 Saravana181187