LTxMenu 2.0.0

LTxMenu 2.0.0

测试已测试
语言语言 Obj-CObjective C
许可协议 MIT
发布最后发布2017 年 5 月

LTxMenu 维护。



LTxMenu 2.0.0

  • 作者:
  • liangtong

类似于 Facebook 新闻通讯,支付宝生活,QQ 空间以及其他社交应用程序。点击下拉按钮以显示更多功能





为什么

在 Facebook 新闻通讯,支付宝生活,QQ 空间等社交应用程序中,它们都包含一个功能性的下拉按钮,当点击时会显示更多功能的列表。我在 GitHub 上没有找到类似的组件,所以我自己使用 Objective-C 编写了一个类似的 UI 控件。参考:https://github.com/kolyvan/kxmenu

入门

  • 将文件拖到项目中
  • pod LTxMenu

如何使用

创建

/**
* class instance method with dataSource and delegate. you can also create with [[LTxMenuView alloc] init] then set the dataSource and the delegate.
**/
+ (instancetype)instanceWithDataSource:(id <LTxMenuViewDataSource>)dataSource delegate:(id <LTxMenuViewDelegate>)delegate;
/**
* show menuView in viewController from a special position.
* @param viewController the menuview 's container
* @param position the menuview 's arrow direction
**/
- (void)showMenu:(UIViewController*)viewController from:(CGRect)position;
/**
* hide the menuview. usually you did not need to call this method
**/
- (void)dismissMenu;

数据源 && 委托

#pragma mark LTxMenuViewDelegate
@protocol LTxMenuViewDelegate<NSObject>

@optional
/**
* called when a specified index was selected.
**/
-(void)didSelectRowAtIndex:(NSInteger)index;

/**
* called when a specified accessoryView was selected.
**/
-(void)didSelectAccessoryView:(UIView*)accessoryView
atIndex:(NSInteger)index;
@end

#pragma mark LTxMenuViewDataSource
@protocol LTxMenuViewDataSource<NSObject>

@required
/**
* Returns the number of rows
**/
- (NSInteger)numberOfRows;

@optional
/**
* Returns the height of specified index. default value is 50.
**/
- (CGFloat)heightForRowAtIndex:(NSInteger)index;

/**
* Returns the attributedTitle of specified index.
**/
- (NSAttributedString*)attributedTitleForRowAtIndex:(NSInteger)index;

/**
* Returns the image of specified index.
**/
- (UIImage*)imageForRowAtIndex:(NSInteger)index;

/**
* Returns the accessoryViews placed at the end of specified index.
**/
- (NSArray<UIView*>*)accessoryViewsAtIndex:(NSInteger)index;
@end;

部署

7.0

许可协议

MIT

电子邮件

[email protected]