Commit 6d9130cc by Daniel Dahan

Updated SideNavigationViewController to support mainViewController swapping.

parent c56f8f96
......@@ -39,7 +39,7 @@ class AMainViewController: UIViewController {
:description: General preparation statements.
*/
private func prepareView() {
view.backgroundColor = MaterialColor.green.base
view.backgroundColor = MaterialColor.blue.base
}
/**
......
......@@ -39,7 +39,7 @@ class BMainViewController: UIViewController {
:description: General preparation statements.
*/
private func prepareView() {
view.backgroundColor = MaterialColor.blue.base
view.backgroundColor = MaterialColor.green.base
}
/**
......@@ -48,12 +48,13 @@ class BMainViewController: UIViewController {
*/
private func prepareSwapSideNavigationViewControllerExample() {
let button: FabButton = FabButton()
button.backgroundColor = MaterialColor.yellow.base
button.addTarget(self, action: "handleSwapViewControllers", forControlEvents: .TouchUpInside)
// Add the button through MaterialLayout.
view.addSubview(button)
button.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignFromBottomRight(view, child: button, bottom: 24, right: 24)
MaterialLayout.alignFromBottomLeft(view, child: button, bottom: 24, left: 24)
MaterialLayout.size(view, child: button, width: 64, height: 64)
}
}
......
Pod::Spec.new do |s|
s.name = 'MK'
s.version = '1.24.12'
s.version = '1.24.13'
s.license = { :type => "AGPL-3.0", :file => "LICENSE" }
s.summary = 'Beautiful Material Design in Swift.'
s.homepage = 'http://materialkit.io'
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.24.12</string>
<string>1.24.13</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -189,12 +189,22 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
}
/**
:name: maintViewController
:name: mainViewController
*/
public var mainViewController: UIViewController! {
didSet {
prepareMainViewController()
if let v: UIViewController = oldValue {
v.willMoveToParentViewController(nil)
addChildViewController(mainViewController)
transitionFromViewController(v,
toViewController: mainViewController,
duration: 0.25,
options: .TransitionCrossDissolve,
animations: nil
) { _ in
v.removeFromParentViewController()
self.mainViewController.didMoveToParentViewController(self)
}
userInteractionEnabled = v.view.userInteractionEnabled
}
}
......@@ -510,8 +520,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
:name: prepareViewControllerWithinContainer
*/
private func prepareViewControllerWithinContainer(controller: UIViewController, container: UIView) {
controller.willMoveToParentViewController(nil)
controller.removeFromParentViewController()
addChildViewController(controller)
container.addSubview(controller.view)
controller.didMoveToParentViewController(self)
......
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