Commit 8d8faee7 by danieldahan

fixed issue with NavigationDrawerController rightView not aligning correctly when rotating device

parent c65fd68e
Pod::Spec.new do |s|
s.name = 'Material'
s.version = '1.42.0'
s.version = '1.42.1'
s.license = 'BSD-3-Clause'
s.summary = 'An animation and graphics framework for Material Design in Swift.'
s.homepage = 'http://cosmicmind.io'
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.42.0</string>
<string>1.42.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -391,6 +391,45 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
layoutSubviews()
}
/// Layout subviews.
public func layoutSubviews() {
if opened {
hideStatusBar()
} else {
showStatusBar()
}
if let v: MaterialView = leftView {
v.width = leftViewWidth
v.height = view.bounds.height
leftViewThreshold = leftViewWidth / 2
if let vc: UIViewController = leftViewController {
vc.view.frame.size.width = v.width
vc.view.frame.size.height = v.height
vc.view.center = CGPointMake(v.width / 2, v.height / 2)
}
}
if let v: MaterialView = rightView {
v.width = rightViewWidth
v.height = view.bounds.height
rightViewThreshold = view.bounds.width - rightViewWidth / 2
if let vc: UIViewController = rightViewController {
vc.view.frame.size.width = v.width
vc.view.frame.size.height = v.height
vc.view.center = CGPointMake(v.width / 2, v.height / 2)
}
}
}
public override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
// Ensures the view is hidden.
if let v: MaterialView = rightView {
v.position.x = size.width + (openedRightView ? -v.width : v.width) / 2
}
}
/**
A method to swap rootViewController objects.
- Parameter toViewController: The UIViewController to swap
......@@ -1159,35 +1198,4 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
container.depth = .None
container.hidden = true
}
/// Layout subviews.
private func layoutSubviews() {
if opened {
hideStatusBar()
} else {
showStatusBar()
}
if let v: MaterialView = leftView {
v.width = leftViewWidth
v.height = view.bounds.height
leftViewThreshold = leftViewWidth / 2
if let vc: UIViewController = leftViewController {
vc.view.frame.size.width = v.width
vc.view.frame.size.height = v.height
vc.view.center = CGPointMake(v.width / 2, v.height / 2)
}
}
if let v: MaterialView = rightView {
v.width = rightViewWidth
v.height = view.bounds.height
rightViewThreshold = view.bounds.width - rightViewWidth / 2
if let vc: UIViewController = rightViewController {
vc.view.frame.size.width = v.width
vc.view.frame.size.height = v.height
vc.view.center = CGPointMake(v.width / 2, v.height / 2)
}
}
}
}
\ No newline at end of file
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