Compare commits

..

8 Commits

Author SHA1 Message Date
jonkykong b39142bc1a Updated podspec 2019-07-22 01:13:26 -07:00
jonkykong a6bd743e99 README correction 2019-07-22 01:13:15 -07:00
jonkykong 749588918c Logic correction 2019-07-22 01:13:02 -07:00
jonkykong f5b6615c72 Podspec update 2019-07-21 21:44:17 -07:00
jonkykong 8804675b80 Demo project correction 2019-07-21 21:43:42 -07:00
jonkykong b0a09a5b7d Fix for layout when menu not dismissed during presentation 2019-07-21 21:43:25 -07:00
jonkykong f1e4efeb46 Refactor 2019-07-21 21:43:07 -07:00
jonkykong aea7592d85 Scope change 2019-07-19 00:49:26 -07:00
5 changed files with 31 additions and 24 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ class MainViewController: UIViewController {
var settings = SideMenuSettings()
settings.presentationStyle = presentationStyle
settings.menuWidth = view.frame.width * CGFloat(screenWidthSlider.value)
settings.menuWidth = min(view.frame.width, view.frame.height) * CGFloat(screenWidthSlider.value)
let styles:[UIBlurEffect.Style?] = [nil, .dark, .light, .extraLight]
settings.blurEffectStyle = styles[blurSegmentControl.selectedSegmentIndex]
settings.statusBarEndAlpha = blackOutStatusBar.isOn ? 1 : 0
+1 -1
View File
@@ -8,7 +8,7 @@
import Foundation
@objcMembers
public class SideMenuPresentationStyle {
open class SideMenuPresentationStyle {
/// Background color behind the views and status bar color
public var backgroundColor: UIColor = .black
/// The starting alpha value of the menu before it appears
@@ -164,24 +164,26 @@ open class UISideMenuNavigationController: UINavigationController {
override open func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
// When presenting a view controller from the menu, the menu view gets moved into another transition view above our transition container
// which can break the visual layout we had before. So, we move the menu view back to its original transition view to preserve it.
if dismissOnPresent && !isBeingDismissed {
// We're presenting a view controller from the menu, so we need to hide the menu so it isn't showing when the presented view is dismissed.
if !isBeingDismissed {
// When presenting a view controller from the menu, the menu view gets moved into another transition view above our transition container
// which can break the visual layout we had before. So, we move the menu view back to its original transition view to preserve it.
if let presentingView = presentingViewController?.view, let containerView = presentingView.superview {
containerView.addSubview(view)
}
transitionController?.transition(presenting: false, animated: animated, alongsideTransition: { [weak self] in
guard let self = self else { return }
self.activeDelegate?.sideMenuWillDisappear?(menu: self, animated: animated)
}, complete: false, completion: { [weak self] _ in
guard let self = self else { return }
self.activeDelegate?.sideMenuDidDisappear?(menu: self, animated: animated)
self.view.isHidden = true
})
} else {
activeDelegate?.sideMenuWillDisappear?(menu: self, animated: animated)
if dismissOnPresent {
// We're presenting a view controller from the menu, so we need to hide the menu so it isn't showing when the presented view is dismissed.
transitionController?.transition(presenting: false, animated: animated, alongsideTransition: { [weak self] in
guard let self = self else { return }
self.activeDelegate?.sideMenuWillDisappear?(menu: self, animated: animated)
}, complete: false, completion: { [weak self] _ in
guard let self = self else { return }
self.activeDelegate?.sideMenuDidDisappear?(menu: self, animated: animated)
self.view.isHidden = true
})
} else {
activeDelegate?.sideMenuWillDisappear?(menu: self, animated: animated)
}
}
}
@@ -206,11 +208,11 @@ open class UISideMenuNavigationController: UINavigationController {
activeDelegate?.sideMenuDidDisappear?(menu: self, animated: animated)
if dismissOnPresent && !isBeingDismissed {
view.isHidden = true
} else {
if isBeingDismissed {
transitionController = nil
interactive = false
} else if dismissOnPresent {
view.isHidden = true
}
}
@@ -237,6 +239,11 @@ open class UISideMenuNavigationController: UINavigationController {
self.rotating = false
}
}
open override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
transitionController?.layout()
}
override open func pushViewController(_ viewController: UIViewController, animated: Bool) {
let push = shouldPushViewController(viewController: viewController, animated: animated) { [weak self] _ in
+4 -4
View File
@@ -137,11 +137,11 @@ dismiss(animated: true, completion: nil)
To use gestures you have to use the `SideMenuManager`. In your `AppDelegate` do something like this:
``` swift
// Define the menus
let menuLeftNavigationController = UISideMenuNavigationController(rootViewController: YourViewController)
SideMenuManager.default.menuLeftNavigationController = menuLeftNavigationController
let leftMenuNavigationController = UISideMenuNavigationController(rootViewController: YourViewController)
SideMenuManager.default.leftMenuNavigationController = leftMenuNavigationController
let menuRightNavigationController = UISideMenuNavigationController(rootViewController: YourViewController)
SideMenuManager.default.menuRightNavigationController = menuRightNavigationController
let rightMenuNavigationController = UISideMenuNavigationController(rootViewController: YourViewController)
SideMenuManager.default.rightMenuNavigationController = rightMenuNavigationController
// Setup gestures: the left and/or right menus must be set up (above) for these to work.
// Note that these continue to work on the Navigation Controller independent of the view controller it displays!
+1 -1
View File
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "SideMenu"
s.version = "6.0.5"
s.version = "6.0.8"
s.summary = "Simple side menu control for iOS in Swift inspired by Facebook. Right and Left sides. No coding required."
# This description is used to generate tags and improve search results.