handsomecode / InteractiveSideMenu

iOS Interactive Side Menu written in Swift.
Apache License 2.0
708 stars 164 forks source link

have a navigationviewcontroller support ? #3

Closed cagricolak closed 7 years ago

cagricolak commented 7 years ago

i want to use navigationviewcontroller on my one of view controller instantiate from your api but i getting this error. Could not cast value of type 'Mosyo.EntriesController' to 'UINavigationController'

let nav = segue.destination as! UINavigationController
let productListController = nav.topViewController as! EntriesController

let cell = sender as! UICollectionViewCell
let indexPath = self.collectionView!.indexPath(for: cell)

how can i fix this ?

thanks.

okonor commented 7 years ago

Hi @cagricolak,

Now the library doesn't support working with UINavigationController.

You can use workaround to add NavigationController to your application. You should create NavigationViewController that is an inheritor of MenuItemContentViewController and then to add actual UINavigationController as a child view controller.

Here is an example:

class NavigationViewController: MenuItemContentViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let innerNavigationController = self.storyboard!.instantiateViewController(withIdentifier: "InnerNavigationController") as! UINavigationController

        self.addChildViewController(innerNavigationController)
        self.view.addSubview(innerNavigationController.view)
    }
}

Thank you for your question. Adding support of UITabBarController and UINavigationController is planned in coming version. Please, feel free to send us pull requests!

schulz89sp commented 7 years ago

Hello, should I create a NavigationViewController.swift file and copy the code? Then how do I call it from the HostViewController? When will the new version come out? Thanks :)

cagricolak commented 7 years ago

thanks everyone I fix that

okonor commented 7 years ago

The new version is planned to be out at the end of the next week.

Recouse commented 7 years ago

@okonor Probably hasn’t added support NavigationController.