Giter Club home page Giter Club logo

lrdsupermenu's Introduction

LrdSuperMenu

仿美团外卖,百度外卖的选择菜单栏

之前看到过DOPDropMenu这个第三方库,挺不错的,花了些时间阅读了一下,参考了一下,修改了一些地方。

效果如图:

##使用方法 将LrdSuperMenu文件夹拖入到工程里面,在需要用到的地方,导入头文件。

类似UITableView,需要实现代理和数据源方法,然后根据项目的实际需要,分别对数据源和代理进行设置。

#pragma  mark - datasource
@class LrdSuperMenu;
@protocol LrdSuperMenuDataSource <NSObject>

@required
//每个column有多少行
- (NSInteger)menu:(LrdSuperMenu *)menu numberOfRowsInColumn:(NSInteger)column;
//每个column中每行的title
- (NSString *)menu:(LrdSuperMenu *)menu titleForRowAtIndexPath:(LrdIndexPath *)indexPath;

@optional
//有多少个column,默认为1列
- (NSInteger)numberOfColumnsInMenu:(LrdSuperMenu *)menu;
//第column列,没行的image
- (NSString *)menu:(LrdSuperMenu *)menu imageNameForRowAtIndexPath:(LrdIndexPath *)indexPath;
//detail text
- (NSString *)menu:(LrdSuperMenu *)menu detailTextForRowAtIndexPath:(LrdIndexPath *)indexPath;
//某列的某行item的数量,如果有,则说明有二级菜单,反之亦然
- (NSInteger)menu:(LrdSuperMenu *)menu numberOfItemsInRow:(NSInteger)row inColumn:(NSInteger)column;
//如果有二级菜单,则实现下列协议
//二级菜单的标题
- (NSString *)menu:(LrdSuperMenu *)menu titleForItemsInRowAtIndexPath:(LrdIndexPath *)indexPath;
//二级菜单的image
- (NSString *)menu:(LrdSuperMenu *)menu imageForItemsInRowAtIndexPath:(LrdIndexPath *)indexPath;
//二级菜单的detail text
- (NSString *)menu:(LrdSuperMenu *)menu detailTextForItemsInRowAtIndexPath:(LrdIndexPath *)indexPath;
@end

#pragma mark - delegate
@protocol LrdSuperMenuDelegate <NSObject>

@optional
//点击
- (void)menu:(LrdSuperMenu *)menu didSelectRowAtIndexPath:(LrdIndexPath *)indexPath;

@end

更具体的请下载demo查看。

喜欢就给颗星呗~

我的博客地址:我的博客

lrdsupermenu's People

Contributors

smallmonster77 avatar

Watchers

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