iOS开源 - 类似美团下拉菜单列表
vb466497
8年前
<h2>DOPDropDownMenu-Enhanced</h2> <p>First, I would like to thank the author of theDOPDropDownMenu for their selfless dedication.</p> <p>This enhanced version includes beautiful improvements to the interface, double tableview capability, optimized code, and improved stability. Enjoy!</p> <h2><strong>CocoaPods</strong></h2> <pre> <code class="language-objectivec">pod 'DOPDropDownMenu-Enhanced', '~> 1.0.0'</code></pre> <h3><strong>应用截图</strong></h3> <p style="text-align:center"><img src="https://simg.open-open.com/show/8417563124824b9dc33ebf7f8b8d9dcd.jpg"> <img src="https://simg.open-open.com/show/e2a04ab3ca8a2144583cca59e2fb0304.gif"></p> <h3><strong>用法</strong></h3> <pre> <code class="language-objectivec">#pragma mark - data source protocol @class DOPDropDownMenu; @protocol DOPDropDownMenuDataSource <NSObject> @required /** * 返回 menu 第column列有多少行 */ - (NSInteger)menu:(DOPDropDownMenu *)menu numberOfRowsInColumn:(NSInteger)column; /** * 返回 menu 第column列 每行title */ - (NSString *)menu:(DOPDropDownMenu *)menu titleForRowAtIndexPath:(DOPIndexPath *)indexPath; @optional /** * 返回 menu 有多少列 ,默认1列 */ - (NSInteger)numberOfColumnsInMenu:(DOPDropDownMenu *)menu; // 新增 返回 menu 第column列 每行image - (NSString *)menu:(DOPDropDownMenu *)menu imageNameForRowAtIndexPath:(DOPIndexPath *)indexPath; // 新增 detailText ,right text - (NSString *)menu:(DOPDropDownMenu *)menu detailTextForRowAtIndexPath:(DOPIndexPath *)indexPath; /** 新增 * 当有column列 row 行 返回有多少个item ,如果>0,说明有二级列表 ,=0 没有二级列表 * 如果都没有可以不实现该协议 */ - (NSInteger)menu:(DOPDropDownMenu *)menu numberOfItemsInRow:(NSInteger)row column:(NSInteger)column; /** 新增 * 当有column列 row 行 item项 title * 如果都没有可以不实现该协议 */ - (NSString *)menu:(DOPDropDownMenu *)menu titleForItemsInRowAtIndexPath:(DOPIndexPath *)indexPath; // 新增 当有column列 row 行 item项 image - (NSString *)menu:(DOPDropDownMenu *)menu imageNameForItemsInRowAtIndexPath:(DOPIndexPath *)indexPath; // 新增 - (NSString *)menu:(DOPDropDownMenu *)menu detailTextForItemsInRowAtIndexPath:(DOPIndexPath *)indexPath; @end #pragma mark - delegate @protocol DOPDropDownMenuDelegate <NSObject> @optional /** * 点击代理,点击了第column 第row 或者item项,如果 item >=0 */ - (void)menu:(DOPDropDownMenu *)menu didSelectRowAtIndexPath:(DOPIndexPath *)indexPath; @end</code></pre> <p> </p> <p>来自:https://github.com/12207480/DOPDropDownMenu-Enhanced</p> <p> </p>