dekatotoro / dekatotoro/SlideMenuControllerSwift
SlideMenuController is not being shown
- Dominant language
- Swift
- Stars
- 3.4k
- Forks
- 742
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to use SlideMenuController library to put a left menu on Home screen but after passing a Login screen. The problem is that when I click on the button of the Login screen, a blank screen is being shown without the menu.
What I have done:
On main.storyboard I have added an UIViewController that has a button (that will be my future Login screen) and I have declared it as "Is Initial View Controller". I also have referenced this screen with UIViewControllerProve.
On UIViewControllerProve I have the following code:
```
import UIKit
class UIViewControllerProve: UIViewController {
@IBAction func btnProve(sender: AnyObject) {
createMenuView()
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
class ContainerViewController: SlideMenuController {
override func awakeFromNib() {
if let controller = self.storyboard?.instantiateViewControllerWithIdentifier("Main") {
self.mainViewController = controller
}
if let controller = self.storyboard?.instantiateViewControllerWithIdentifier("Left") {
self.leftViewController = controller
}
super.awakeFromNib()
}
}
private func createMenuView() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let mainViewController = storyboard.instantiateViewControllerWithIdentifier("MainViewController") as! MainViewController
let leftViewController = storyboard.instantiateViewControllerWithIdentifier("LeftViewController") as! LeftViewController
let nvc: UINavigationController = UINavigationController(rootViewController: mainViewController)
UINavigationBar.appearance().tintColor = UIColor(hex: "689F38")
leftViewController.mainViewController = nvc
self.slideMenuController()?.automaticallyAdjustsScrollViewInsets = true
let appDelegate = UIApplication.sharedApplication().delegate
appDelegate!.window?!.backgroundColor = UIColor(red: 236.0, green: 238.0, blue: 241.0, alpha: 1.0)
appDelegate!.window?!.rootViewController = self.slideMenuController()
appDelegate!.window?!.makeKeyAndVisible()
self.slideMenuController()?.openLeft()
}
}
```
On AppDelegate.swift I have commented those functions: createMenuView and application.
I am taking as reference the example that the creator has in his GitHub.
How can I make that the menu will be shown when I click on the button of my Login screen? Am I missing something?
Thanks in advance!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with main.storyboard and UIViewControllerProve in the issue, then trace the login button action through createMenuView and the AppDelegate.swift root-controller setup. Check the storyboard identifiers and the controller hierarchy while running the app; done means clicking the login button displays the configured main and left menu instead of a blank screen.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100