Code Monkey home page Code Monkey logo

Comments (12)

analleraP avatar analleraP commented on July 22, 2024

I have the same problem @fsad, you managed to solve?

from enswiftsidemenu.

fsad avatar fsad commented on July 22, 2024

@JDoes unfortunately not :( ... I managed to create a sidemenu with following tutorial: http://www.raywenderlich.com/78568/create-slide-out-navigation-panel-swift

At the bottom of the page there are the project source files to start right away.
Regards

from enswiftsidemenu.

lucasgerard avatar lucasgerard commented on July 22, 2024

Hi, thanks for this great work but I also have this problem...

from enswiftsidemenu.

evnaz avatar evnaz commented on July 22, 2024

Hi @fsad , sorry for long response.
What kind of segue do you use to return to the first VC? It probably creates a new instance of navigation controller. I would suggest don't use segue and make it programmatically.

from enswiftsidemenu.

lucasgerard avatar lucasgerard commented on July 22, 2024

Hi Evnaz,
I personally use a modal segue as the return segue

from enswiftsidemenu.

robomotic avatar robomotic commented on July 22, 2024

Hi guys,
same problem here.
@evnaz could you provide an example of doing it programmatically or maybe do a sample project to show the right way to do it?
I am using as the others segues and unwind segues and the menu disappears.

from enswiftsidemenu.

evnaz avatar evnaz commented on July 22, 2024

Hi @robomotic ,
Unfortunately i cant reproduce the issue, can you please post basic project with view controller's logic causing the problem.

from enswiftsidemenu.

robomotic avatar robomotic commented on July 22, 2024

Hi @evnaz ,
will do give me a couple of hours, I am cloning yours on mine and adding the example.
Cheers.

from enswiftsidemenu.

robomotic avatar robomotic commented on July 22, 2024

Here we go the demo project is here:
https://github.com/robomotic/ENSwiftSideMenu
You can see how the Menu disappears after the segue transition from ViewController to ViewController3.

I also added an unwind segue with the Back button (I couldn't do with the left swipe because that of course should trigger the menu).
Also it will be nice to have a navigation control in this case.

Let me know what you think.
Cheers!

from enswiftsidemenu.

evnaz avatar evnaz commented on July 22, 2024

I checked your example and noted that ViewController3 is a modal view controller, it is outside of the navigation view controller's stack, as you see in the RightSegue.swift it inserts as a subview of current window:

window?.insertSubview(secondVCView, aboveSubview: firstVCView)

The side menu can't handle gestures over the inserted view. So, side menu only works if you use a push(show) segue. To prevent back action on swipe you can disable back swipe gesture by:

override func viewWillAppear(animated: Bool) {
        navigationController?.interactivePopGestureRecognizer.enabled = false
}

At the moment i don't see any way how to manage modal view controllers by side menu.

from enswiftsidemenu.

robomotic avatar robomotic commented on July 22, 2024

So I made a commit in the RightSeque.swift to use the push instead of mode:

-        let window = UIApplication.sharedApplication().keyWindow
-        window?.insertSubview(secondVCView, aboveSubview: firstVCView)
+        //let window = UIApplication.sharedApplication().keyWindow
+        //window?.insertSubview(secondVCView, aboveSubview: firstVCView)
+        
+        let navigat = UINavigationController()
+        navigat.pushViewController(self.destinationViewController as! UIViewController, animated: true)

But I am still unable to see the Menu,is it to do with the UINavigationController that doesn't get initialised with the one of the Menu?

from enswiftsidemenu.

evnaz avatar evnaz commented on July 22, 2024

Hi @robomotic ,
You don't need to use custom segue to push a view controller, just use show(push) segue.
And, yes, you create a new instance of navigation controller and then just present the destination controller as a modal view, in that case just created nav controller is not used.

Also remove this function or modify the return value in the ViewController3:

func sideMenuShouldOpenSideMenu() -> Bool {
        println("sideMenuShouldOpenSideMenu")
        return false
}

from enswiftsidemenu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.