Code Monkey home page Code Monkey logo

mtsidemenubar's Introduction

MTSideMenubar

Easily creating side menu bar in your project with dynamic size and open/close left side as well as right side. MTSideMenubar written in Swift 3.0 and easy to use in project.

BackgroundImage

#Installation

Manually

Clone or Download this Repo. Then simply drag the class MTSideMenubar.swift to your Xcode project.

###Simply way to integrate MTSideMenubar

###Implement MoreMenuBarDelegate

    class ViewController: UIViewController, MoreMenuBarDelegate {
        override func viewDidLoad() {
            super.viewDidLoad()

        }     
        //MARK: - MoreMenuBar Delegate
        func tappedOnEvent(sender: UIControl, sideMenubar: MTSideMenubar) {

            if sideMenubar == sideMenubarLeft {
                print("Left Side Menu Button Tag : ",sender.tag)
            }
            else if sideMenubar == sideMenubarRight {
                print("Right Side Menu Button Tag : ",sender.tag)
            }
        }
        func moreMenuItemHide(sideMenubar: MTSideMenubar) {
            print("moreMenuItemHide")
        }
        func moreMenuItemShow(sideMenubar: MTSideMenubar) {
            print("moreMenuItemShow")
        }
    }

###Create MTSideMenubar

    class ViewController: UIViewController, MoreMenuBarDelegate {
        var sideMenubarLeft:MTSideMenubar!
        var arrBtnImageListLeft = [MTSideMenuImageList]()
        override func viewDidLoad() {
                super.viewDidLoad()

                //Left Side Menu bar Create
                arrBtnImageListLeft.append(MTSideMenuImageList(imgButton: #imageLiteral(resourceName: "imgTwitter")))
                arrBtnImageListLeft.append(MTSideMenuImageList(imgButton: #imageLiteral(resourceName: "imgInstagram")))
                arrBtnImageListLeft.append(MTSideMenuImageList(imgButton: #imageLiteral(resourceName: "imgGooglePlus")))
                arrBtnImageListLeft.append(MTSideMenuImageList(imgButton: #imageLiteral(resourceName: "imgFacebook")))
                arrBtnImageListLeft.append(MTSideMenuImageList(imgButton: #imageLiteral(resourceName: "imgDribble")))

                var heightOfMenuBarLeft = (DeviceScale.SCALE_X * 20.0) //Top-Bottom Spacing
                heightOfMenuBarLeft += ((DeviceScale.SCALE_X * 16.66) * CGFloat((arrBtnImageListLeft.count - 1))) //Button between spacing
                heightOfMenuBarLeft += (CGFloat(arrBtnImageListLeft.count) * 50.0) //Button height spacing

                let originYOfMenuBarLeft = (self.view.frame.size.height / 2.0) - (heightOfMenuBarLeft / 2)

                sideMenubarLeft = MTSideMenubar.init(frame: CGRect(x: (ScreenSize.WIDTH - (DeviceScale.SCALE_X * 84.0)),y: originYOfMenuBarLeft,width: (DeviceScale.SCALE_X * 84.0),height: heightOfMenuBarLeft)).createUI(view: self.view, arrBtnImageList: arrBtnImageListLeft) as! MTSideMenubar
                sideMenubarLeft.delegate = self
        }
    }

###Show menu list left side

    sideMenubarLeft.show(isShowingLeftToRight: true)

###Show menu list right side

    sideMenubarLeft.show(isShowingLeftToRight: false)

###Hide menu bar

    sideMenubarLeft.hide()

mtsidemenubar's People

Contributors

manekdilip avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.