All Projects → Friend-LGA → Lgsidemenucontroller

Friend-LGA / Lgsidemenucontroller

Licence: mit
iOS view controller which manages left and right side views

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Lgsidemenucontroller

Side Menu.ios
Animated side menu with customizable UI
Stars: ✭ 2,702 (+45.58%)
Mutual labels:  sidemenu, side-menu
Slidingrootnav
DrawerLayout-like ViewGroup, where a "drawer" is hidden under the content view, which can be shifted to make the drawer visible.
Stars: ✭ 2,939 (+58.35%)
Mutual labels:  sidemenu, side-menu
jquery-jside-menu
jSide Menu is a well designed, simple and clean side navigation menu with dropdowns.
Stars: ✭ 23 (-98.76%)
Mutual labels:  sidemenu, slide-menu
Sidemenu
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less.
Stars: ✭ 5,267 (+183.78%)
Mutual labels:  sidemenu, slidemenu
SwiftyBase
SwiftyBase - A Swift library for Create Project in iOS ( Base Project)
Stars: ✭ 33 (-98.22%)
Mutual labels:  sidemenu, viewcontroller
Aicustomviewcontrollertransition
Easy and tidy way for creating custom UIViewController transitions for iOS
Stars: ✭ 130 (-93%)
Mutual labels:  viewcontroller, uiviewcontroller
Licensingviewcontroller
📃 UIViewController subclass with a simple API for displaying licensing information.
Stars: ✭ 107 (-94.23%)
Mutual labels:  uiviewcontroller
Ios Slide Menu
iOS Slide Menu with ability to add both left and right menu, and built in gesture recognizer. Similar to Path and Facebook
Stars: ✭ 1,549 (-16.54%)
Mutual labels:  side-menu
Mipivotpagecontroller
MIPivotPageController allows switching view controllers with an horizontal swipe
Stars: ✭ 95 (-94.88%)
Mutual labels:  viewcontroller
Fwsidemenu
侧滑控件:支持左、右滑动的侧滑菜单,可配置单侧滑动,同时可配置菜单宽度等,更多配置请参考”可设置参数“。参考了QQ用户体验:支持边缘侧滑,解决手势冲突问题(边缘范围可设置)。提供OC使用Demo。
Stars: ✭ 90 (-95.15%)
Mutual labels:  sidemenu
Flutter slidable
A Flutter implementation of slidable list item with directional slide actions.
Stars: ✭ 2,014 (+8.51%)
Mutual labels:  slide-menu
Xlslideswitch
iOS 仿照今日头条滚动列表
Stars: ✭ 136 (-92.67%)
Mutual labels:  viewcontroller
Swifty360player
iOS 360-degree video player streaming from an AVPlayer.
Stars: ✭ 118 (-93.64%)
Mutual labels:  uiviewcontroller
Lmsidebarcontroller
LMSideBarController is a simple side bar controller inspired by Tappy and Simon Hoang.
Stars: ✭ 108 (-94.18%)
Mutual labels:  sidemenu
Xlbubbletransition
iOS ViewController间切换的转场动画
Stars: ✭ 127 (-93.16%)
Mutual labels:  uiviewcontroller
Rdgliderviewcontroller Swift
Control for a floating view gliding over a ViewController Edit
Stars: ✭ 102 (-94.5%)
Mutual labels:  viewcontroller
Djsemimodalviewcontroller
Simple semi modal presentation dialog with stacked content
Stars: ✭ 137 (-92.62%)
Mutual labels:  uiviewcontroller
Panslip
Use PanGesture to dismiss view on UIViewController and UIView
Stars: ✭ 93 (-94.99%)
Mutual labels:  uiviewcontroller
Towebviewcontroller
A view controller class for iOS that allows users to view web pages directly within an app.
Stars: ✭ 1,500 (-19.18%)
Mutual labels:  uiviewcontroller
Rrviewcontrollerextension
UINavigationBar appearance management, memory leak detection, convenient UIViewController property and methods
Stars: ✭ 133 (-92.83%)
Mutual labels:  uiviewcontroller

LGSideMenuController

iOS view controller which manages left and right side views.

Platform SwiftPM CocoaPods Carthage License

Preview

Presentation Style: Scale From Big

Presentation Style: Slide Above Blurred

Presentation Style: Slide Below Shifted

Presentation Style: Slide Aside + Usage: Inside UINavigationController

Other presentation styles and examples of usage you can try in included demo projects. Also you can make your very own style, as they are highly customizable.

Installation

LGSideMenuController Version Min iOS Version Language
1.0.0 - 1.0.10 6.0 Objective-C
1.1.0 - 2.2.0 8.0 Objective-C
2.3.0 9.0 Objective-C
3.0.0 9.0 Swift

With Source Code

  1. Download repository
  2. Add LGSideMenuController directory to your project
  3. Enjoy!

With Swift Package Manager

Starting with Xcode 9.0 you can use built-in swift package manager, follow apple documentation. First supported version is 2.3.0.

With CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. To install with CocoaPods, follow the "Get Started" section on CocoaPods.

Podfile

platform :ios, '9.0'
use_frameworks!
pod 'LGSideMenuController'

Then import framework where you need to use the library:

import LGSideMenuController

With Carthage

Carthage is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods. To install with carthage, follow instructions on Carthage.

Cartfile

github "Friend-LGA/LGSideMenuController"

Then import framework where you need to use the library:

import LGSideMenuController

Usage

LGSideMenuController is inherited from UIViewController, so you can use it the same way as any other UIViewController.

First, you need to provide basic view controllers or views, which will be used to show root, left and right views.

  • rootViewController or rootView. This view controller or view will be used as the root view.
  • leftViewController or leftView. This view controller or view will be used as the left side view.
  • rightViewController or rightView. This view controller or view will be used as the right side view.
// You don't have to assign both: left and right side views. 
// Just one is enough, but you can use both if you want.
// UIViewController() and UIView() here are just as an example. 
// Use any UIViewController or UIView to assign, as you wish.

let sideMenuController = 
    LGSideMenuController(rootViewController: UIViewController(),
                         leftViewController: UIViewController(),
                         rightViewController: UIViewController())

// ===== OR =====

let sideMenuController = 
    LGSideMenuController(rootView: UIView(),
                         leftView: UIView(),
                         rightView: UIView())

// ===== OR =====

let sideMenuController = LGSideMenuController()
sideMenuController.rootViewController = UIViewController()
sideMenuController.leftViewController = UIViewController()
sideMenuController.rightViewController = UIViewController()

// ===== OR =====

let sideMenuController = LGSideMenuController()
sideMenuController.rootView = UIView()
sideMenuController.leftView = UIView()
sideMenuController.rightView = UIView()

Second, you probably want to choose presentation style, there are a few:

  • scaleFromBig. Side view is located below the root view and when appearing is changing its scale from large to normal. Root view also is going to be minimized and moved aside.
  • scaleFromLittle. Side view is located below the root view and when appearing is changing its scale from small to normal. Root view also is going to be minimized and moved aside.
  • slideAbove. Side view is located above the root view and when appearing is sliding from a side. Root view is staying still.
  • slideAboveBlurred. Side view is located above the root view and when appearing is sliding from a side. Root view is staying still. Side view has blurred background.
  • slideBelow. Side view is located below the root view. Root view is going to be moved aside.
  • slideBelowShifted. Side view is located below the root view. Root view is going to be moved aside. Also content of the side view has extra shifting.
  • slideAside. Side view is located at the same level as root view and when appearing is sliding from a side. Root view is going to be moved together with the side view.
sideMenuController.leftViewPresentationStyle = .slideAboveBlurred
sideMenuController.rightViewPresentationStyle = .slideBelowShifted

Third, you might want to change width of your side view. By default it's calculated as smallest side of the screen minus 44.0, then compare it to 320.0 and choose smallest number. Like so: min(min(UIScreen.main.bounds.width, UIScreen.main.bounds.height) - 44.0, 320.0).

sideMenuController.leftViewWidth = 250.0
sideMenuController.rightViewWidth = 100.0

To show/hide side views just use any of these and similar methods:

// ===== LEFT =====

/// Shows left side view.
func showLeftView()

/// Hides left side view.
func hideLeftView()

/// Toggle (shows/hides) left side view.
func toggleLeftView()

// ===== RIGHT =====

/// Shows right side view.
func showRightView()

/// Hides right side view.
func hideRightView()

/// Toggle (shows/hides) right side view.
func toggleRightView()

Quick Example

You don't have to create both: left and right side views. Just one is enough, but you can use both if you want. We create them here just as an example.

Without Storyboard

  1. Create root view controller (for example UINavigationController).
  2. Create left view controller (for example UITableViewController).
  3. Create right view controller (for example UITableViewController).
  4. Create instance of LGSideMenuController with these controllers.
  5. Configure.
// Simple AppDelegate.swift
// Just as an example. Don't take it as a strict approach.

import UIKit
import LGSideMenuController

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // 1. Create root view controller.
        // Here it is just simple `UINavigationController`.
        // Read apple documentation and google to create one:
        // https://developer.apple.com/documentation/uikit/uinavigationcontroller
        // https://google.com/search?q=uinavigationcontroller+example
        let rootNavigationController = UINavigationController(rootViewController: UIViewController())

        // 2. Create left and right view controllers.
        // Here it is just simple `UITableViewController`.
        // Read apple documentation and google to create one:
        // https://developer.apple.com/documentation/uikit/uitableviewcontroller
        // https://google.com/search?q=uitableviewcontroller+example
        let leftViewController = UITableViewController()
        let rightViewController = UITableViewController()

        // 3. Create instance of LGSideMenuController with above controllers as root and left.
        let sideMenuController = LGSideMenuController(rootViewController: rootNavigationController,
                                                      leftViewController: leftViewController,
                                                      rightViewController: rightViewController)

        // 4. Set presentation style by your taste if you don't like the default one.
        sideMenuController.leftViewPresentationStyle = .slideAboveBlurred
        sideMenuController.rightViewPresentationStyle = .slideBelowShifted

        // 5. Set width for the left view if you don't like the default one.
        sideMenuController.leftViewWidth = 250.0
        sideMenuController.rightViewWidth = 100.0

        // 6. Make it `rootViewController` for your window.
        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window!.rootViewController = sideMenuController
        self.window!.makeKeyAndVisible()

        // 7. Done!
        return true
    }

}

For deeper examples check NonStoryboard Demo Project.

With Storyboard

  1. Create instance of LGSideMenuController as initial view controller for your Storyboard.
  2. Create root view controller (for example UINavigationController).
  3. Create left view controller (for example UITableViewController).
  4. Create right view controller (for example UITableViewController).
  5. Now you need to connect them all using segues of class LGSideMenuSegue with identifiers: root, left and right.

  1. You can change leftViewWidth, rightViewWidth and most of the other properties inside LGSideMenuController's attributes inspector.

  1. enum properties are not yet supported (by apple) inside Xcode builder, so to change leftViewPresentationStyle and rightViewPresentationStyle you will need to do it programmatically. For this you will need to create counterpart for your LGSideMenuController and change these values inside. This is done by creating LGSideMenuController subclass and assigning this class to your view controller inside Storyboard's custom class section.
// SideMenuController.swift

import UIKit
import LGSideMenuController

class SideMenuController: LGSideMenuController {

    // `viewDidLoad` probably the best place to assign them.
    // But if necessary you can do it in other places as well.
    override func viewDidLoad() {
        super.viewDidLoad()

        leftViewPresentationStyle = .slideAboveBlurred
        rightViewPresentationStyle = .slideBelowShifted
    }

}

For deeper examples check Storyboard Demo Project.

Wiki

If you still have questions, please take a look at the wiki.

More

For more details see files itself and try Xcode demo projects:

Frameworks

If you like LGSideMenuController, check out my other useful libraries:

  • LGAlertView Customizable implementation of UIAlertViewController, UIAlertView and UIActionSheet. All in one. You can customize every detail. Make AlertView of your dream! :)
  • LGPlusButtonsView Customizable iOS implementation of Floating Action Button (Google Plus Button, fab).

License

LGSideMenuController is released under the MIT license. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].