Giter Club home page Giter Club logo

mlmenu's Introduction

MLMenu

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Preview

Demo

Requirements!

iOS 8.0

Installation

MLMenu is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'MLMenu'

Use

// 导入头文件

#import <MLMenu/MLMenuView.h>
- (void)testCode_One
{
    NSArray *titles = @[@"发起群聊",@"添加朋友",@"扫一扫",@"收付款"];
   
    MLMenuView *menuView = [[MLMenuView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 100 - 10, 0, 100, 44 * 4) WithTitles:titles WithImageNames:nil WithMenuViewOffsetTop:k_StatusBarAndNavigationBarHeight WithTriangleOffsetLeft:80 triangleColor:[UIColor whiteColor]];
    menuView.separatorOffSet = 10;
    menuView.separatorColor = MLClolor(51, 51, 51, 1);
    [menuView setMenuViewBackgroundColor:[UIColor whiteColor]];
    menuView.titleColor = [UIColor blackColor];
    [menuView setCoverViewBackgroundColor:MLClolor(51, 51, 51, 0.5)];
    menuView.didSelectBlock = ^(NSInteger index) {
        NSLog(@"%zd",index);
    };
    [menuView showMenuEnterAnimation:MLEnterAnimationStyleNone];
    
}

- (void)testCode_Two
{
    NSArray *titles = @[@"发起群聊",@"添加朋友",@"扫一扫",@"收付款"];
    NSArray *images = @[@"scan",@"scan",@"scan",@"scan"];

    MLMenuView *menuView = [[MLMenuView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 100 - 10, 0, 100, 44 * 4) WithTitles:titles WithImageNames:images WithMenuViewOffsetTop:k_StatusBarAndNavigationBarHeight WithTriangleOffsetLeft:80 triangleColor:nil];
    menuView.didSelectBlock = ^(NSInteger index) {
        NSLog(@"%zd",index);
    };
    [menuView showMenuEnterAnimation:MLEnterAnimationStyleNone];
}


- (void)testCode_Three
{
    NSArray *titles = @[@"发起群聊",@"添加朋友",@"扫一扫",@"收付款"];
    NSArray *images = @[@"scan",@"scan",@"scan",@"scan"];
    MLMenuView *menuView = [[MLMenuView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 100 - 10, 0, 100, 44 * 4) WithTitles:titles WithImageNames:images WithMenuViewOffsetTop:k_StatusBarAndNavigationBarHeight WithTriangleOffsetLeft:80 triangleColor:nil];
    menuView.didSelectBlock = ^(NSInteger index) {
        NSLog(@"%zd",index);
    };
    [menuView showMenuEnterAnimation:MLEnterAnimationStyleRight];
}

- (void)testCode_Four
{
    NSArray *titles = @[@"发起群聊",@"添加朋友",@"扫一扫",@"收付款"];
    NSArray *images = @[@"scan",@"scan",@"scan",@"scan"];
    
        MLMenuView *menuView = [[MLMenuView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 100 - 10, 0, 100, 44 * 4)  WithTitles:titles WithImageNames:images WithMenuViewOffsetTop:k_StatusBarAndNavigationBarHeight];
    [menuView setCoverViewBackgroundColor:[UIColor lightGrayColor]];
    menuView.didSelectBlock = ^(NSInteger index) {
        NSLog(@"%zd",index);
    };
    [menuView showMenuEnterAnimation:MLEnterAnimationStyleTop];
}

- (void)testCode_Five
{
    NSArray *titles = @[@"发起群聊",@"添加朋友",@"扫一扫",@"收付款"];

    MLMenuView *menuView = [[MLMenuView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 100 - 10, 0, 100, 44 * 4) WithTitles:titles WithImageNames:nil WithMenuViewOffsetTop:k_StatusBarAndNavigationBarHeight WithTriangleOffsetLeft:80 triangleColor:[UIColor whiteColor]];
    [menuView setCoverViewBackgroundColor:MLClolor(51, 51, 51, 0.5)];
    menuView.separatorColor = MLClolor(51, 51, 51, 0.5);
    [menuView setMenuViewBackgroundColor:[UIColor whiteColor]];
    menuView.titleColor =  MLClolor(51, 51, 51, 1);
    menuView.didSelectBlock = ^(NSInteger index) {
        NSLog(@"%zd",index);
    };
    [menuView showMenuEnterAnimation:MLEnterAnimationStyleNone];
}

Other Use

// 设置线条颜色(线条可调整透明度)
menuView.separatorColor = [UIColor ...];
// 设置字体大小
menuView.font = [UIFont systemFontOfSize:...];
// 设置字体颜色
menuView.titleColor = [UIColor ...];
// 设置背景颜色
[menuView setMenuViewBackgroundColor:...];
// 设置蒙版背景颜色
[menuView setCoverViewBackgroundColor:..];

Author

MrDML, [email protected]

License

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

mlmenu's People

Contributors

mrdml avatar

Stargazers

怎样 avatar Musk66 avatar  avatar  avatar Ming~En~Long avatar Burapali avatar  avatar  avatar  avatar  avatar  avatar JianZhou avatar  avatar 程序员不务正业 avatar 叶义峰 avatar  avatar chensc avatar Just-coding avatar LLy avatar  avatar Carabineiro avatar  avatar

Watchers

James Cloos avatar Carabineiro avatar  avatar  avatar

mlmenu's Issues

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.