Skip to content

wataru-maeda/multiSlideMenu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi Slide Menu

Features

  • Top, Left, Bottom and Right side positioning
  • Easy to use, fully customisable, added slide menus without needing to write tons of code
  • Enable to toggle slide menu with a button action.
  • Keeps track of x, y point while dragging slide menu.
  • Supports continuous swiping between side menus on 4 sides in a single gesture.

Demos

Installation

Add the MultiSlideMenuViewController.swift to your project manually (drag & drap the file into your project).

Usage

  1. Please add a file subclassed of MultiSlideMenuViewController
class ViewController: MultiSlideMenuViewController {
  1. Initialize SlideMenuView with position and bounds, then pass the views to the super.setupSlideMenus(views: ). That's all!
// Sets up left slide menu
let sideMenu = SlideMenuView(position: .Left, bounds: view.frame)
sideMenu.backgroundColor = .yellow
super.setupSlideMenus(views: [sideMenu])

It's specifing the slide menu is Left position, the view size is view.frame and background color is yellow.

Customize View

It's fully customisable!

  1. Create subview of SlideMenuView class
  2. You can add code in the override func draw(_ rect: CGRect) for your custom UI
import UIKit

class CustomSlideMenu: SlideMenuView {
    override func draw(_ rect: CGRect) {
        super.draw(rect)
        // your code here for the custom UI...
    }
}

See the code or sample gif for more info.

Toggle by button action

You can call show() or hide() for toggle the views.
For the hide() function, please check here or the show(), you can check from here You can see the sample gif.

Tacking position in SlideMenu

Tracking the current position is also important if you like to implement specific action in the specific timing. There are some override functions to recognize the events.

  • func willShow(point: CGPoint)
  • func didShow(point: CGPoint)
  • func willDisappear(point: CGPoint)
  • func didDisappear(point: CGPoint)
  • func startDragging(point: CGPoint)
  • func continueDragging(point: CGPoint)
  • func endDragging(point: CGPoint)

Your can override there functions that keeps track of x, y position while dragging
See the code or sample gif for more info.

Tacking position in ViewController

Your can override the functions func getPresentingSlideWithPoint(slideMenu: point: )
See the code or sample gif for more info.

Requirements

iOS 8+
Swift 3.0+
Xcode 8.0+

License

This project is available under the MIT license. See the LICENSE file for more info.

About

Slide menus toggled by pan gesture appearing from 4 directions, Top, Left. Bottom and Right

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages