Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to access appdelegate in sidemenu #23

Open
ArjunSa786 opened this issue Oct 12, 2015 · 4 comments
Open

how to access appdelegate in sidemenu #23

ArjunSa786 opened this issue Oct 12, 2015 · 4 comments

Comments

@ArjunSa786
Copy link

    var storyboard:UIStoryboard = UIStoryboard(name:
        "Main", bundle: NSBundle.mainBundle())

    sideMenuViewController?.contentViewController = UINavigationController(rootViewController: (storyboard.instantiateViewControllerWithIdentifier("NotificationViewController") as? NotificationViewController)!)
    sideMenuViewController?.hideMenuViewController()

its go to that view controller but all property and object it nill and does not work menu
this method not call sideMenuViewController?._presentLeftMenuViewController()

@LuaiKalkatawi
Copy link

@ArjunSa786 is this the same issue that you had before I have updated my code #25

@ArjunSa786
Copy link
Author

yes same issue LuaiKalkatawi

@ArjunSa786 ArjunSa786 reopened this Nov 19, 2015
@mohammadshalhoob
Copy link

this code work with me

        guard let vacanceDetailsTableViewController = AppDelegate.storyboard.instantiateViewController(withIdentifier: "vacanceDetailsTableViewController") as? vacanceDetailsTableViewController else{completionHandler(.noData);return}
        vacanceDetailsTableViewController.id = Int(id) ?? 0
        vacanceDetailsTableViewController.getVacanceData = true
        guard let SSASideMenuView = AppDelegate.storyboard.instantiateViewController(withIdentifier: "SSASideMenuView") as? SSASideMenu else{completionHandler(.noData);return}
        SSASideMenuView.contentViewController = vacanceDetailsTableViewController
        let nav = UINavigationController(rootViewController: SSASideMenuView)
        guard let SSASide = window?.rootViewController as? SSASideMenu else{completionHandler(.noData);return}
        SSASide.contentViewController = nav
        completionHandler(.noData)

@mohammadshalhoob
Copy link

and this to git top view with ssasidemenu

public class func topViewController(_ base: UIViewController? = UIApplication.shared.keyWindow?.rootViewController,returnNav:Bool=false) -> UIViewController? {
    if let SSASide = base as? SSASideMenu {
        if let nav = SSASide.contentViewController as? UINavigationController{
            if returnNav{
                return nav
            }else {
        return topViewController(nav.visibleViewController)
            }
        }else{ // without nav
        return topViewController(SSASide.contentViewController)
        }
    }
    if let nav = base as? UINavigationController {
        return topViewController(nav.visibleViewController)
    }
    
    if let tab = base as? UITabBarController {
        let moreNavigationController = tab.moreNavigationController
        
        if let top = moreNavigationController.topViewController, top.view.window != nil {
            return topViewController(top)
        } else if let selected = tab.selectedViewController {
            return topViewController(selected)
        }
    }
    
    if let presented = base?.presentedViewController {
        return topViewController(presented)
    }
    
    return base
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants