Commit e69083a5 by Daniel Dahan

Updated transition logic for motionTransitionType when using Tabs and base TransitionController.

parent 5e8497db
...@@ -712,8 +712,8 @@ ...@@ -712,8 +712,8 @@
96D88BFD1C1328D800B91418 /* LICENSE */, 96D88BFD1C1328D800B91418 /* LICENSE */,
96D88BFC1C1328D800B91418 /* Info.plist */, 96D88BFC1C1328D800B91418 /* Info.plist */,
96D88C091C1328D800B91418 /* Material.h */, 96D88C091C1328D800B91418 /* Material.h */,
9630ACB71F29A26B00B4217D /* Frameworks */,
96334EF51C8B84660083986B /* Assets.xcassets */, 96334EF51C8B84660083986B /* Assets.xcassets */,
9630ACB71F29A26B00B4217D /* Frameworks */,
96BCB7EC1CB40DE900C806FE /* Font */, 96BCB7EC1CB40DE900C806FE /* Font */,
96BCB7571CB40DC500C806FE /* iOS */, 96BCB7571CB40DC500C806FE /* iOS */,
); );
......
Subproject commit b9a2576453296a86582ed43aad357456e76a7924 Subproject commit 83ab6b006233162b0fc49602e2e2754a3949ebac
...@@ -272,7 +272,7 @@ extension CALayer { ...@@ -272,7 +272,7 @@ extension CALayer {
return return
} }
cornerRadius = bounds.size.width / 2 cornerRadius = frame.size.width / 2
} }
/// Sets the shadow path. /// Sets the shadow path.
......
...@@ -176,16 +176,34 @@ internal extension NavigationBar { ...@@ -176,16 +176,34 @@ internal extension NavigationBar {
} }
item.toolbar.backgroundColor = .clear item.toolbar.backgroundColor = .clear
item.titleView = item.toolbar item.titleView = item.toolbar
guard let v = item.titleView as? Toolbar else { guard let v = item.titleView as? Toolbar else {
return return
} }
removeConstraints(constraints) if #available(iOS 11.0, *) {
let h = CGFloat(heightPreset.rawValue)
frame = CGRect(x: frame.origin.x, y: 20, width: frame.size.width, height: h)
for subview in subviews {
var stringFromClass = NSStringFromClass(subview.classForCoder)
if stringFromClass.contains("BarBackground") {
subview.frame = CGRect(x: 0, y: 0, width: frame.width, height: h)
}
stringFromClass = NSStringFromClass(subview.classForCoder)
if stringFromClass.contains("BarContent") {
subview.frame = CGRect(x: subview.frame.origin.x, y: 0, width: subview.frame.width, height: h)
}
}
v.frame = frame
} else {
v.frame = bounds
}
v.contentEdgeInsets = contentEdgeInsets v.contentEdgeInsets = contentEdgeInsets
v.interimSpace = interimSpace v.interimSpace = interimSpace
v.frame = bounds
} }
} }
...@@ -120,6 +120,7 @@ open class NavigationController: UINavigationController { ...@@ -120,6 +120,7 @@ open class NavigationController: UINavigationController {
*/ */
open func prepare() { open func prepare() {
isMotionEnabled = true isMotionEnabled = true
navigationBar.frame.size.width = view.bounds.width
navigationBar.heightPreset = .normal navigationBar.heightPreset = .normal
view.clipsToBounds = true view.clipsToBounds = true
...@@ -135,6 +136,7 @@ open class NavigationController: UINavigationController { ...@@ -135,6 +136,7 @@ open class NavigationController: UINavigationController {
/// Calls the layout functions for the view heirarchy. /// Calls the layout functions for the view heirarchy.
open func layoutSubviews() { open func layoutSubviews() {
navigationBar.setNeedsUpdateConstraints()
navigationBar.updateConstraints() navigationBar.updateConstraints()
navigationBar.setNeedsLayout() navigationBar.setNeedsLayout()
navigationBar.layoutIfNeeded() navigationBar.layoutIfNeeded()
......
...@@ -201,12 +201,13 @@ fileprivate extension TabsController { ...@@ -201,12 +201,13 @@ fileprivate extension TabsController {
return return
} }
var isAuto = false switch motionTransitionType {
case .auto:
switch viewController.motionModalTransitionType { switch viewController.motionTransitionType {
case .auto: case .auto:
isAuto = true Motion.shared.setAnimationForNextTransition(fvcIndex < tvcIndex ? .slide(direction: .left) : .slide(direction: .right))
viewController.motionModalTransitionType = fvcIndex < tvcIndex ? .slide(direction: .left) : .slide(direction: .right) default:break
}
default:break default:break
} }
...@@ -214,15 +215,11 @@ fileprivate extension TabsController { ...@@ -214,15 +215,11 @@ fileprivate extension TabsController {
delegate?.tabsController?(tabsController: self, willSelect: viewController) delegate?.tabsController?(tabsController: self, willSelect: viewController)
} }
super.transition(to: viewController) { [weak self, isAuto = isAuto, viewController = viewController, completion = completion] (isFinished) in super.transition(to: viewController) { [weak self, viewController = viewController, completion = completion] (isFinished) in
guard let s = self else { guard let s = self else {
return return
} }
if isAuto {
viewController.motionModalTransitionType = .auto
}
completion?(isFinished) completion?(isFinished)
if isTriggeredByUserInteraction { if isTriggeredByUserInteraction {
...@@ -277,6 +274,7 @@ fileprivate extension TabsController { ...@@ -277,6 +274,7 @@ fileprivate extension TabsController {
case .top: case .top:
container.frame.origin.y = p container.frame.origin.y = p
container.frame.size.height = y container.frame.size.height = y
case .bottom: case .bottom:
container.frame.origin.y = 0 container.frame.origin.y = 0
container.frame.size.height = y container.frame.size.height = y
......
...@@ -148,6 +148,16 @@ open class TransitionController: UIViewController { ...@@ -148,6 +148,16 @@ open class TransitionController: UIViewController {
open func transition(to viewController: UIViewController, completion: ((Bool) -> Void)? = nil) { open func transition(to viewController: UIViewController, completion: ((Bool) -> Void)? = nil) {
prepare(viewController: viewController, in: container) prepare(viewController: viewController, in: container)
switch motionTransitionType {
case .auto:break
default:
switch viewController.motionTransitionType {
case .auto:
viewController.motionTransitionType = motionTransitionType
default:break
}
}
view.isUserInteractionEnabled = false view.isUserInteractionEnabled = false
Motion.shared.transition(from: rootViewController, to: viewController, in: container) { [weak self, viewController = viewController, completion = completion] (isFinished) in Motion.shared.transition(from: rootViewController, to: viewController, in: container) { [weak self, viewController = viewController, completion = completion] (isFinished) in
guard let s = self else { guard let s = self else {
......
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