Git Product home page Git Product logo

pagemenu's Introduction

Introduction

LZPageMenu is a powerful controller section, not only supports multiple styles of sub-menu, support for carrying the head view, support for Obejective-C and Swift, and supports CocoaPods.Not only to achieve the function, but also from memory and performance optimization, such as how to ensure that the current layer only one sub-controller display, and how to complete the menu sub-view of the reuse. Therefore LZPageMenu implementation and the mainstream of the realization of probably there are differences, but there may be more problems, the project is in its infancy, look forward to your advice!

The basic effect

The basic effect.gif

Supported styles

Dot:

Dot.PNG

Image:

Image.PNG

Square:

Square.PNG

SolidOval:

SolidOval.PNG

HollowOval:

HollowOval.PNG

Custom Location:

Custom.PNG

NavigationBar:

NavigationBar.PNG

NSAttributeString:

NSAttributeString.PNG

Average Width:

Average.PNG

Custom Width:

Custom.PNG

UpdateTitles:

UpdateTitles.gif

Custom Menu:

Custom.gif

StretchHead:

StretchHead.gif

OffsetHead:

OffsetHead.gif

One more tables:

Table.PNG

Usage

Add LZPageMenu and LZPageMenuProtocols two files to the project,LZPageMenuProtocols.swift specifies the properties and methods that can be used,LZPageMenu.swift is the control's implementation code.For more details, please refer to the sample project.You can refer to the following ways to use:

 pageMenu = LZPageMenu.init(frame: CGRect.init(x: 0.0, y: 0.0, width: Demo.screenWidth, height: Demo.screenHeight - Demo.naviBarHeight()))
        for index in 1...10 {
            let vc = InfoViewController()
            vc.infoLabel.text = "Number:\(index)"
            vc.title = "Number:\(index)"
            pageMenu.viewControllers.append(vc)
        }
        pageMenu.selectionIndicatorType = .dot
        pageMenu.selectionIndicatorHeight = 5.0
        pageMenu.reloadData()
        view.addSubview(pageMenu.view)

All available properties, methods are provided in the LZPageMenuProtocols.swift file:

For example, set the indicator line:

/// Whether to display the indicator line, default is true
    var needShowSelectionIndicator: Bool {get set}
    /// The height of the indicator line, default is 2
    var selectionIndicatorHeight: Float  {get set}
    /// Indicator line offset, that is the distance retracted of up and down , the value will affect the width and height of the indicator line. Dot and Image types default center, line, ellipse, etc. have same height with menu. default is (0,0,0,0)
    var selectionIndicatorOffset: UIEdgeInsets {get set}
    /// The color of the indicator line, default is red
    var selectionIndicatorColor: UIColor {get set}
    /// The type of the indicator line, default is line
    var selectionIndicatorType: LZSelectionIndicatorType {get set}
    /// This value is useful when the indicator line is of type SelectionIndicatorTypeImage, default is nil
    var selectionIndicatorImage: UIImage? {get set}
    /// When the indicator line is SelectionIndicatorTypeImage type, used to control the width of the picture, if you do not set the value, the default is in the center, and take the original width of the picture.
    var selectionIndicatorImageWidth: Float?  {get set}
    /// Whether to make the indicator line equal to the width of the text, default is YES
    var selectionIndicatorWithEqualToTextWidth: Bool {get set}

Welcome to raise issues, fork

pagemenu's People

Contributors

randy1993 avatar

Stargazers

 avatar

Watchers

James Cloos 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.