CSMenu for iOS

Hi all, I am just after a few pointers with this component as I hope it will allow me to convert a project I already have using tabcontroller to something with a slide in menu, I think my issue is just a lack of understanding but here goes.

I have added the CSMenuController which then sets the MainViewController to a view controller with an embedded navigation controller, this has a menu icon in the header which opens a left hand menu, what I am now stuck with is how do I get any action in the left hand menu controller to push a new viewcontroller to the mainViewcontrollers navigation controller ? or if not push then at least have a common view navigation controller with the same menu for all my viewcontrollers.

(sorry hope that makes sense, seems a bit of a mouthful)

I have been through the detailed example however although they have a nice menu called settings none of the actions do anything.

Really want to use this component as otherwise I may have to use the other approach which to not use the storyboard.

Many Thanks Sam

Posts

  • Tom-PrattTom-Pratt GBMember ✭✭

    Hi Sam, I created CSMenu so thank you for trying it out. I'm sorry I didn't spot your post until now and I hope it's not too late.

    If you take a look at the Colors menu on the left hand side in that detailed sample there is an example of how to communicate with a menu. The colors menu view controller has a ColorSelected event handler which is invoked by the relevant user interaction. The main view controller can assign to that event handler using the following extension method:

        this.GetLeftMenuViewController<ColorsViewController> ().ColorSelected += (object sender, ColorEventArgs e) => ...
    

    The required information gathered in the menu is relayed in the event args. In your case this EventHandler would pass the information needed to perform the push.

    Alternatively, as a shortcut, you could use this.GetLeftMenuViewController() to pass a reference to your navigation controller into your menu. Then use that reference to perform the push from within the menu itself.

    I hope that helps and I'm happy to answer any more questions regarding CSMenu

    Regards,
    Tom

  • Sam.3816Sam.3816 USMember ✭✭

    Thanks Tom, I have been sorting out a whole host of other upgrades regarding this app and had shelved the side menu on the apple version for the time, however now you have given me so pointers I will have another go. I did send two emails to the email address on the website just in case you hadn't received those as well.

  • Tom-PrattTom-Pratt GBMember ✭✭

    Apologies for missing your emails Sam. I hope that CSMenu will help you with your project.

    Also worth mentioning is that CSMenu is compatible with both the Unified and Classic APIs so there's no need to worry about the 64 bit deadline in February when using CSMenu.

  • Hi
    I would like to use CSMenu control
    I tried to use it but I had some difficulties

    I have:
    letmenu a tableView, when click it I want push an other view controller, have some viewcontroller with navigationcontroller

    do you have a example?
    Thank you

  • BenLevy.4265BenLevy.4265 USMember ✭✭

    Has anyone been able to get this to work with a Master Detail iPad app? All is well for the iPhone storyboard.

  • Tom-PrattTom-Pratt GBMember ✭✭

    Hi Ben,

    I'm sending you an email with some more info for you to reply to.

  • ChristopherSinghChristopherSingh USMember ✭✭

    Has anyone been able to use this control with MVVMCross?

  • CanekMorenoCanekMoreno MXMember

    Hi,
    Have you any update that works with Xamarin.iOS instead of mono touch ??

  • Tom-PrattTom-Pratt GBMember ✭✭

    CSMenu should include a DLL for that. It has both a iOS 32bit DLL and a 64bit DLL. Check in the lib folder for CSMenu in your project and look for "ios-unified".

    Hope that helps

  • PCVoyagesPCVoyages CAMember ✭✭

    Hi Tom, I've been trying out your CSMENU component and so far is well documented and structured so thank you for that. I do have a similar question from this original post. Once an item from the side menu has been selected, how is it possible to push to another ViewController without removing the "Three lines" button? Usualy in any app that allows an SideMenu, the ThreeLines button remains present and functional unless we navigate into the View being displayed. How can this be managed with your component?

    Thanks,

    Jean

  • Tom-PrattTom-Pratt GBMember ✭✭

    Hi Jean,

    The main thing you'll need to do is ensure that when you set up your CSMenuController, make sure that you set a UINavigationController to be its main view controller. So something like this in your subclass of CSMenuController...

    SetMainViewController("MyNavigationController");
    

    Then you'll need to set up an event subscription between your navigation controller and the view controller you have set to act as the menu screen. As described in the second post in this thread. Something like this using the extension method...

    this.GetLeftMenuViewController<SideMenuViewController> ().MenuItemClickedEvent += ....
    

    This code is in the navigation controller so when the event fires you can push a new view controller onto the stack in code or trigger a segue or however you want to cause the push navigation. Also note that the "GetLeftMenuViewController" extension method will work in any child view controller below the CSMenuController, so you can use it in your navigation controller or any child of the navigation controller etc. Depending on where it's most convenient to trigger the navigation push.

    Hope that helps,
    Tom

  • PCVoyagesPCVoyages CAMember ✭✭

    Thanks for the explanation Tom it did help me a lot!

    Jean

Sign In or Register to comment.