iOS開源 - 類似美團下拉菜單列表

vb466497 8年前發布 | 15K 次閱讀 iOS開發 移動開發

DOPDropDownMenu-Enhanced

First, I would like to thank the author of theDOPDropDownMenu for their selfless dedication.

This enhanced version includes beautiful improvements to the interface, double tableview capability, optimized code, and improved stability. Enjoy!

CocoaPods

pod 'DOPDropDownMenu-Enhanced', '~> 1.0.0'

應用截圖

用法

#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>

       

      來自:https://github.com/12207480/DOPDropDownMenu-Enhanced

       

 本文由用戶 vb466497 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!