Commit e5d70b4e by Daniel Dahan

issue-933: Fixed issue where NavigationDrawerController was not displaying the…

issue-933: Fixed issue where NavigationDrawerController was not displaying the leftViewController and rightViewController.
parent e8dafec7
## 2.12.8
* [issue-933](https://github.com/CosmicMind/Material/issues/933): Fixed issue where `NavigationDrawerController` was not displaying the `leftViewController` and `rightViewController`.
* [issue-940](https://github.com/CosmicMind/Material/issues/940): Fixed an issue where the `TransitionController` was not executing the lifecycle functions for the initial `rootViewController`.
## 2.12.7
......
Pod::Spec.new do |s|
s.name = 'Material'
s.version = '2.12.7'
s.version = '2.12.8'
s.license = 'BSD-3-Clause'
s.summary = 'A UI/UX framework for creating beautiful applications.'
s.homepage = 'http://materialswift.com'
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.12.7</string>
<string>2.12.8</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -450,6 +450,30 @@ open class NavigationDrawerController: TransitionController {
rootViewController.view.frame = container.bounds
}
open override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
leftViewController?.beginAppearanceTransition(true, animated: animated)
rightViewController?.beginAppearanceTransition(true, animated: animated)
}
open override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
leftViewController?.endAppearanceTransition()
rightViewController?.endAppearanceTransition()
}
open override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
leftViewController?.beginAppearanceTransition(false, animated: animated)
rightViewController?.beginAppearanceTransition(false, animated: animated)
}
open override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
leftViewController?.endAppearanceTransition()
rightViewController?.endAppearanceTransition()
}
open override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
// Ensures the view is isHidden.
......@@ -976,27 +1000,9 @@ extension NavigationDrawerController {
view.sendSubview(toBack: contentViewController.view)
}
/// A method that prepares the leftViewController.
fileprivate func prepareLeftViewController() {
guard let v = leftView else {
return
}
prepare(viewController: leftViewController, in: v)
}
/// A method that prepares the rightViewController.
fileprivate func prepareRightViewController() {
guard let v = rightView else {
return
}
prepare(viewController: rightViewController, in: v)
}
/// A method that prepares the leftView.
fileprivate func prepareLeftView() {
guard nil != leftViewController else {
guard let v = leftViewController else {
return
}
......@@ -1005,18 +1011,19 @@ extension NavigationDrawerController {
leftViewWidth = .phone == Device.userInterfaceIdiom ? 280 : 320
leftView = UIView()
leftView!.frame = CGRect(x: 0, y: 0, width: leftViewWidth, height: view.bounds.height)
leftView!.backgroundColor = nil
leftView!.backgroundColor = .white
view.addSubview(leftView!)
leftView!.isHidden = true
leftView!.layer.position.x = -leftViewWidth / 2
leftView!.layer.zPosition = 2000
prepareLeftViewController()
prepare(viewController: v, in: leftView!)
}
/// A method that prepares the leftView.
fileprivate func prepareRightView() {
guard nil != rightViewController else {
guard let v = rightViewController else {
return
}
......@@ -1025,13 +1032,14 @@ extension NavigationDrawerController {
rightViewWidth = .phone == Device.userInterfaceIdiom ? 280 : 320
rightView = UIView()
rightView!.frame = CGRect(x: view.bounds.width, y: 0, width: rightViewWidth, height: view.bounds.height)
rightView!.backgroundColor = nil
rightView!.backgroundColor = .white
view.addSubview(rightView!)
rightView!.isHidden = true
rightView!.layer.position.x = view.bounds.width + rightViewWidth / 2
rightView!.layer.zPosition = 2000
prepareRightViewController()
prepare(viewController: v, in: rightView!)
}
/// Prepare the left pan gesture.
......
......@@ -212,22 +212,14 @@ internal extension TransitionController {
- Parameter in container: A UIView that is the parent of the
passed in controller view within the view hierarchy.
*/
func prepare(viewController: UIViewController?, in container: UIView) {
guard let v = viewController else {
return
}
guard !childViewControllers.contains(v) else {
return
}
addChildViewController(v)
container.addSubview(v.view)
v.didMove(toParentViewController: self)
v.view.frame = container.bounds
v.view.clipsToBounds = true
v.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
v.view.contentScaleFactor = Screen.scale
func prepare(viewController: UIViewController, in container: UIView) {
addChildViewController(viewController)
container.addSubview(viewController.view)
viewController.didMove(toParentViewController: self)
viewController.view.frame = container.bounds
viewController.view.clipsToBounds = true
viewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
viewController.view.contentScaleFactor = Screen.scale
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment