Compare commits

..

25 Commits

Author SHA1 Message Date
jonkykong a1716035c3 Update README for Cocoapods. 2017-01-12 14:17:04 -08:00
jonkykong 99456afaed Update pod spec. 2017-01-12 14:16:49 -08:00
jonkykong 4b92f5a776 Refactoring. 2017-01-12 14:14:05 -08:00
jonkykong 459a4a1e9f Second fix for multiple gestures actuating and causing problem. 2017-01-12 14:13:43 -08:00
jonkykong 717fd3a325 Update README for GitHub. 2017-01-10 13:13:59 -08:00
jonkykong 802146708e Merge tag '2.1.4'
* tag '2.1.4':
  Silence warning.
  Update README for Cocoapods.
  Update podspec.
  Fix for multiple gestures causing crashes when presenting or dismissing menu. SideMenuTransition is due for a refactoring of logic to simplify that I don’t have time for now.
  Update to Launch Screen.
  Say “SideMenu” instead of “Example” in demo project.
2017-01-10 13:13:04 -08:00
jonkykong f34452d040 Updating README for GitHub. 2017-01-09 12:49:17 -08:00
jonkykong bda990bbef Silence warning. 2017-01-09 12:41:27 -08:00
jonkykong b8f13dc333 Update README for Cocoapods. 2017-01-09 12:36:07 -08:00
jonkykong 793ffd77bc Update podspec. 2017-01-09 12:35:09 -08:00
jonkykong 132a50766e Fix for multiple gestures causing crashes when presenting or dismissing menu. SideMenuTransition is due for a refactoring of logic to simplify that I don’t have time for now. 2017-01-09 12:34:10 -08:00
jonkykong 85f00c63b4 Update to Launch Screen. 2017-01-09 12:32:11 -08:00
jonkykong e71ec145f1 Say “SideMenu” instead of “Example” in demo project. 2017-01-09 12:31:44 -08:00
jonkykong 37b0f6d57e Update README for GitHub. 2017-01-06 23:21:25 -08:00
jonkykong ccee3e1f83 Merge tag '2.1.3'
* tag '2.1.3':
  Update podspec and README for Cocoapods.
  Cleaner version of logic proposed by @saltyskip.
  adding possibility of tab bar or nav bar
  make tab bar controller
2017-01-06 23:17:38 -08:00
jonkykong 1786b459c5 Update podspec and README for Cocoapods. 2017-01-06 23:14:40 -08:00
jonkykong 5f5fdcba7a Merge branch 'pr/125' into 2.1.3
* pr/125:
  Cleaner version of logic proposed by @saltyskip.
  adding possibility of tab bar or nav bar
  make tab bar controller
2017-01-06 23:12:43 -08:00
jonkykong 27f490435e Cleaner version of logic proposed by @saltyskip. 2017-01-06 23:11:50 -08:00
Jon Kent 96dd886575 Update ISSUE_TEMPLATE.md 2017-01-04 11:03:59 -08:00
andrei 5b4b6afdbe adding possibility of tab bar or nav bar 2017-01-04 18:34:20 +09:00
andrei fa6f9eb9e1 make tab bar controller 2017-01-04 17:54:29 +09:00
Jon Kent 0c3aaa471d Update README.md 2016-12-30 17:59:42 -08:00
jonkykong f184415f7c Ready correction. 2016-12-28 18:34:08 -06:00
jonkykong 1c883abf55 Updated readme for Github. 2016-12-28 15:08:25 -06:00
jonkykong f82138dc87 Merge tag '2.1.2'
* tag '2.1.2':
  Updated podspec/readme.
  Removed redundant copies of source files causing confusion with updating cocoa pods. Replaced with links to pod files. Unsure if this will break Carthage.
  Cocoapods still not updating. Updating podspec in prep for next workaround.
  Reversing edit.
  Making frivolous change to file not updating to attempt redetection.
  Cocoapods still not updating. Updated podspec.
  Cocoapods does not appear to have updated… retrying.
2016-12-28 15:08:06 -06:00
7 changed files with 89 additions and 68 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
<!--- Provide a general summary of your changes in the Title above -->
<!--- IF YOU DELETE OR IGNORE THIS TEMPLATE WHEN OPENING A NEW ISSUE, YOUR ISSUE WILL BE IGNORED -->
## New Issue Checklist
<!--- Please complete all of the checks below before submitting a new issue -->
I have read the [guidelines for contributing](https://github.com/jonkykong/SideMenu/blob/master/.github/CONTRIBUTING.md) and I understand:
+2
View File
@@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>SideMenu</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
+10 -4
View File
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -18,12 +22,14 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright © 2016 jonkykong. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright © 2016 Jon Kent. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
<rect key="frame" x="20" y="626.5" width="335" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SideMenu" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="20" y="202" width="335" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
+64 -51
View File
@@ -17,8 +17,35 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
internal static let singleton = SideMenuTransition()
internal static var presentDirection: UIRectEdge = .left;
internal static weak var tapView: UIView?
internal static weak var statusBarView: UIView?
internal static weak var tapView: UIView? {
didSet {
guard let tapView = tapView else {
return
}
tapView.autoresizingMask = [.flexibleHeight, .flexibleWidth]
let exitPanGesture = UIPanGestureRecognizer()
exitPanGesture.addTarget(SideMenuTransition.self, action:#selector(SideMenuTransition.handleHideMenuPan(_:)))
let exitTapGesture = UITapGestureRecognizer()
exitTapGesture.addTarget(SideMenuTransition.self, action: #selector(SideMenuTransition.handleHideMenuTap(_:)))
tapView.addGestureRecognizer(exitPanGesture)
tapView.addGestureRecognizer(exitTapGesture)
}
}
internal static weak var statusBarView: UIView? {
didSet {
guard let statusBarView = statusBarView else {
return
}
if let menuShrinkBackgroundColor = SideMenuManager.menuAnimationBackgroundColor {
statusBarView.backgroundColor = menuShrinkBackgroundColor
} else {
statusBarView.backgroundColor = UIColor.black
}
statusBarView.isUserInteractionEnabled = false
}
}
// prevent instantiation
fileprivate override init() {}
@@ -154,7 +181,9 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
internal class func hideMenuStart() {
NotificationCenter.default.removeObserver(SideMenuTransition.singleton)
guard let mainViewController = SideMenuTransition.viewControllerForPresentedMenu,
let menuView = SideMenuTransition.presentDirection == .left ? SideMenuManager.menuLeftNavigationController?.view : SideMenuManager.menuRightNavigationController?.view else {return}
let menuView = SideMenuTransition.presentDirection == .left ? SideMenuManager.menuLeftNavigationController?.view : SideMenuManager.menuRightNavigationController?.view else {
return
}
menuView.transform = CGAffineTransform.identity
mainViewController.view.transform = CGAffineTransform.identity
@@ -292,67 +321,45 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
// get reference to our fromView, toView and the container view that we should perform the transition in
let container = transitionContext.containerView
// prevent any other menu gestures from firing
container.isUserInteractionEnabled = false
if let menuBackgroundColor = SideMenuManager.menuAnimationBackgroundColor {
container.backgroundColor = menuBackgroundColor
}
// create a tuple of our screens
let screens : (from:UIViewController, to:UIViewController) = (transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)!, transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)!)
let fromViewController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)!
let toViewController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)!
// assign references to our menu view controller and the 'bottom' view controller from the tuple
// remember that our menuViewController will alternate between the from and to view controller depending if we're presenting or dismissing
let menuViewController = (!presenting ? screens.from : screens.to)
let topViewController = !presenting ? screens.to : screens.from
let menuViewController = presenting ? toViewController : fromViewController
let topViewController = presenting ? fromViewController : toViewController
let menuView = menuViewController.view
let topView = topViewController.view
let menuView = menuViewController.view!
let topView = topViewController.view!
// prepare menu items to slide in
if presenting {
var tapView: UIView?
if !SideMenuManager.menuPresentingViewControllerUserInteractionEnabled {
tapView = UIView()
tapView!.autoresizingMask = [.flexibleHeight, .flexibleWidth]
let exitPanGesture = UIPanGestureRecognizer()
exitPanGesture.addTarget(SideMenuTransition.self, action:#selector(SideMenuTransition.handleHideMenuPan(_:)))
let exitTapGesture = UITapGestureRecognizer()
exitTapGesture.addTarget(SideMenuTransition.self, action: #selector(SideMenuTransition.handleHideMenuTap(_:)))
tapView!.addGestureRecognizer(exitPanGesture)
tapView!.addGestureRecognizer(exitTapGesture)
SideMenuTransition.tapView = tapView
}
SideMenuTransition.originalSuperview = topView?.superview
SideMenuTransition.originalSuperview = topView.superview
// add the both views to our view controller
switch SideMenuManager.menuPresentMode {
case .viewSlideOut, .viewSlideInOut:
container.addSubview(menuView!)
container.addSubview(topView!)
if let tapView = tapView {
topView?.addSubview(tapView)
}
container.addSubview(menuView)
container.addSubview(topView)
case .menuSlideIn, .menuDissolveIn:
container.addSubview(topView!)
if let tapView = tapView {
container.addSubview(tapView)
}
container.addSubview(menuView!)
container.addSubview(topView)
container.addSubview(menuView)
}
if SideMenuManager.menuFadeStatusBar {
let blackBar = UIView()
if let menuShrinkBackgroundColor = SideMenuManager.menuAnimationBackgroundColor {
blackBar.backgroundColor = menuShrinkBackgroundColor
} else {
blackBar.backgroundColor = UIColor.black
}
blackBar.isUserInteractionEnabled = false
container.addSubview(blackBar)
SideMenuTransition.statusBarView = blackBar
let statusBarView = UIView()
SideMenuTransition.statusBarView = statusBarView
container.addSubview(statusBarView)
}
SideMenuTransition.hideMenuStart() // offstage for interactive
SideMenuTransition.hideMenuStart()
}
// perform the animation!
@@ -360,12 +367,14 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
let options: UIViewAnimationOptions = interactive ? .curveLinear : UIViewAnimationOptions()
UIView.animate(withDuration: duration, delay: 0, options: options, animations: { () -> Void in
if self.presenting {
SideMenuTransition.presentMenuStart() // onstage items: slide in
SideMenuTransition.presentMenuStart()
} else {
SideMenuTransition.hideMenuStart()
}
menuView?.isUserInteractionEnabled = false
}) { (finished) -> Void in
container.isUserInteractionEnabled = true
// tell our transitionContext object that we've finished animating
if transitionContext.transitionWasCancelled {
let viewControllerForPresentedMenu = SideMenuTransition.viewControllerForPresentedMenu
@@ -375,7 +384,6 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
} else {
SideMenuTransition.presentMenuComplete()
}
menuView?.isUserInteractionEnabled = true
transitionContext.completeTransition(false)
@@ -389,13 +397,18 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
if self.presenting {
SideMenuTransition.presentMenuComplete()
menuView?.isUserInteractionEnabled = true
if !SideMenuManager.menuPresentingViewControllerUserInteractionEnabled {
let tapView = UIView()
topView.addSubview(tapView)
tapView.frame = topView.bounds
SideMenuTransition.tapView = tapView
}
transitionContext.completeTransition(true)
switch SideMenuManager.menuPresentMode {
case .viewSlideOut, .viewSlideInOut:
container.addSubview(topView!)
container.addSubview(topView)
case .menuSlideIn, .menuDissolveIn:
container.insertSubview(topView!, at: 0)
container.insertSubview(topView, at: 0)
}
if let statusBarView = SideMenuTransition.statusBarView {
container.bringSubview(toFront: statusBarView)
@@ -406,7 +419,7 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
SideMenuTransition.hideMenuComplete()
transitionContext.completeTransition(true)
menuView?.removeFromSuperview()
menuView.removeFromSuperview()
}
}
@@ -125,9 +125,10 @@ open class UISideMenuNavigationController: UINavigationController {
super.pushViewController(viewController, animated: animated)
return
}
guard let presentingViewController = presentingViewController as? UINavigationController else {
print("SideMenu Warning: attempt to push a View Controller from \(self.presentingViewController.self) where its navigationController == nil. It must be embedded in a Navigation Controller for this to work.")
let tabBarController = presentingViewController as? UITabBarController
guard let navigationController = (tabBarController?.selectedViewController ?? presentingViewController) as? UINavigationController else {
print("SideMenu Warning: attempt to push a View Controller from \(presentingViewController.self) where its navigationController == nil. It must be embedded in a Navigation Controller for this to work.")
return
}
@@ -144,9 +145,9 @@ open class UISideMenuNavigationController: UINavigationController {
})
if SideMenuManager.menuAllowPopIfPossible {
for subViewController in presentingViewController.viewControllers {
for subViewController in navigationController.viewControllers {
if type(of: subViewController) == type(of: viewController) {
presentingViewController.popToViewController(subViewController, animated: animated)
navigationController.popToViewController(subViewController, animated: animated)
CATransaction.commit()
return
}
@@ -154,20 +155,20 @@ open class UISideMenuNavigationController: UINavigationController {
}
if SideMenuManager.menuReplaceOnPush {
var viewControllers = presentingViewController.viewControllers
var viewControllers = navigationController.viewControllers
viewControllers.removeLast()
viewControllers.append(viewController)
presentingViewController.setViewControllers(viewControllers, animated: animated)
navigationController.setViewControllers(viewControllers, animated: animated)
CATransaction.commit()
return
}
if let lastViewController = presentingViewController.viewControllers.last, !SideMenuManager.menuAllowPushOfSameClassTwice && type(of: lastViewController) == type(of: viewController) {
if let lastViewController = navigationController.viewControllers.last, !SideMenuManager.menuAllowPushOfSameClassTwice && type(of: lastViewController) == type(of: viewController) {
CATransaction.commit()
return
}
presentingViewController.pushViewController(viewController, animated: animated)
navigationController.pushViewController(viewController, animated: animated)
CATransaction.commit()
}
}
+1 -2
View File
@@ -4,10 +4,9 @@
[![License](https://img.shields.io/cocoapods/l/SideMenu.svg?style=flat)](http://cocoapods.org/pods/SideMenu)
[![Platform](https://img.shields.io/cocoapods/p/SideMenu.svg?style=flat)](http://cocoapods.org/pods/SideMenu)
## Shameless Plugs
### If you like SideMenu, give it a ★ at the top right of its [GitHub](https://github.com/jonkykong/SideMenu) page.
My name is Jon Kent and I'm a freelance iOS designer, developer, and mobile strategist. I love coffee and play the drums. [**Hire me**](mailto:contact@jonkent.me?subject=Let's build something amazing.) to help you make cool stuff. I also have a [website](http://jonkent.me).
My name is Jon Kent and I'm a freelance iOS designer, developer, and mobile strategist. I love coffee and play the drums. [**Hire me**](mailto:contact@jonkent.me?subject=Let's build something amazing.) to help you make cool stuff. I also have a [website](http://jonkent.me). *Note: If you're having a problem with SideMenu, please open an [issue](https://github.com/jonkykong/SideMenu/issues/new) and do not email me.*
## Overview
+1 -1
View File
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "SideMenu"
s.version = "2.1.2"
s.version = "2.1.5"
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.