Closed patriksharma closed 6 years ago
I tried this code, but it doesn't work. Condition fails.
class NavigationViewController: UINavigationController, SideMenuItemContent {
}
class VideoUploadController: UIViewController {
@IBAction func openMenu(_ sender: Any) {
if let navigationViewController = self.navigationController as? SideMenuItemContent {
navigationViewController.showSideMenu()
}
}
}
@rob5408 @AlexKorovyansky @johnroescher @alexzub @progn any one please help me to get this working
@patriksharma hello! I also have the same problem... did you solve it?
@indiraAman Yes, Solved it. IT took lot of time to understand but Take it this way.
They have default storyboardable. swift
file which you need to include . Basically You need to create seprate storyboard file for each side menu. For example I have created a side menu with 4 options. Then I need to create 4 storyboard files and use. Then only it works for you
static func storyboardNavigationController() -> UINavigationController {
print ("name",defaultStoryboardName)
let storyboard = UIStoryboard(name: defaultStoryboardName, bundle: nil)
// guard let nc = storyboard.
guard let nc = storyboard.instantiateInitialViewController() as? UINavigationController else {
fatalError("Could not instantiate initial storyboard with name: \(defaultStoryboardName)")
}
return nc
}
@patriksharma thanx, but unfortunately it didn't help me(( and i can't figure out why
@indiraAman Ok do a simple thing
1) Open sample code added in the -InterativeSideMenuproject folder 2) Now drag and drop
Storyboardable.swiftfile into your project 3) Now drag and drop
HostViewController.swiftand
POAMenuViewController.swift` into your project
In HostViewController
class. Change this method with your Classes and Make seprate storyboard for each class.
private func contentControllers() -> [UIViewController] {
let myAccountViewController = myAccountViewController.storyboardNavigationController()
let officeManualController = officeManualViewController.storyboardNavigationController()
let curriculmController = curriculumViewController.storyboardNavigationController()
let checkListController = checklistViewController.storyboardNavigationController()
let employeeController = employeeListViewController.storyboardNavigationController()
return [myAccountViewController,officeManualController,curriculmController,checkListController,employeeController]
I have created 5 side menu classes. So 5 storyboard files (Make sure you keep Same Name for storyboard) for example myAccountViewController.storyboard
for myAccountViewController
and in Storyboard file Make a tick Mark for is initial View Controller
property .
I hope it helps you and work for you . Just follow the sample code they have created for navigation controller
@patriksharma it works) thanx! you helped me a lot!))))))
@indiraAman Nice to hear that from you :)
Dua mein Yaad rakhna
Well I called Class A from side Menu and Menu icon is working fine from here. Now I Move to Class B from Class A using Navigation controller.
I added menu icon there but open side menu is not working from there. Any idea ?