dekatotoro / dekatotoro/SlideMenuControllerSwift

How to use navigation bar on non menu controller

Open
#54 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
3.4k
Forks
742
PR merge metrics
No merged PRs in 30d

Description

Hi
On non menu controller i am not able to add our back button,
Is there any to allow the back button, or how can i navigate the non menu controller, so that user can click on the back button and come back directly to home view controller.
Below is my code

import UIKit

class CategoryViewController: UIViewController {

```
var delegate: LeftMenuProtocol?

var categoryType:NSString!

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.

print(categoryType);
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
self.removeNavigationBarItem()
}

override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
coordinator.animateAlongsideTransition(nil, completion: { (context: UIViewControllerTransitionCoordinatorContext!) -> Void in
if let viewController = self.slideMenuController()?.mainViewController as? UINavigationController {
if viewController.topViewController.isKindOfClass(CategoryViewController) {
self.slideMenuController()?.removeLeftGestures()
self.slideMenuController()?.removeRightGestures()
}
}
})
}

@IBAction func backButtonAction(sender: UIBarButtonItem) {
delegate?.navigateViewController(LeftMenu.Home)
}

@IBAction func buttonAction(sender: AnyObject) {
delegate?.navigateViewController(LeftMenu.Home)

}

/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
```

}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.