-
Notifications
You must be signed in to change notification settings - Fork 0
/
ENSideMenuNavigationController.swift
56 lines (44 loc) · 1.67 KB
/
ENSideMenuNavigationController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// RootNavigationViewController.swift
// SwiftSideMenu
//
// Created by Evgeny Nazarov on 29.09.14.
// Copyright (c) 2014 Evgeny Nazarov. All rights reserved.
//
import UIKit
open class ENSideMenuNavigationController: UINavigationController, ENSideMenuProtocol {
open var sideMenu : ENSideMenu?
open var sideMenuAnimationType : ENSideMenuAnimation = .default
// MARK: - Life cycle
open override func viewDidLoad() {
super.viewDidLoad()
}
public init( menuViewController: UIViewController, contentViewController: UIViewController?) {
super.init(nibName: nil, bundle: nil)
if (contentViewController != nil) {
self.viewControllers = [contentViewController!]
}
sideMenu = ENSideMenu(sourceView: self.view, menuViewController: menuViewController, menuPosition:.left)
view.bringSubview(toFront: navigationBar)
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
open override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Navigation
open func setContentViewController(_ contentViewController: UIViewController) {
self.sideMenu?.hideSideMenu()
switch sideMenuAnimationType {
case .none:
self.viewControllers = [contentViewController]
break
default:
contentViewController.navigationItem.hidesBackButton = true
self.setViewControllers([contentViewController], animated: true)
break
}
}
}