ESPopupMenu 0.1.6

ESPopupMenu 0.1.6

Yue Zhao 维护。



  • 作者
  • ElegantSolution

ESPopupMenu

CI Status Version License Platform

描述

一款用于 iOS 的简单易用的弹出菜单,它会根据弹出的 UI 组件自动计算框架和箭头位置。

1 2 3

安装

ESPopupMenu 通过 CocoaPods 提供支持。要安装它,只需将以下行添加到您的 Podfile 中

pod 'ESPopupMenu', '~> 0.1.6'

用法

只需一行代码即可

/// This will automatically pop a menu with an arrow pointed to the view.
/// @param view:  Any UI component that has a view of frame that can be used to calculate the menu's frame and arrow
/// @param delegate: ESPopupMenuDelegate, should not be nil
/// @param numOfRows: number of rows to show in menu
/// @param rowWidth: row's width
/// @param rowHeight: SINGLE row's height, NOT the height of entire menu

[ESPopupMenu addPopupMenuTo:view delegate:self numOfRows:3 rowWidth:120 rowHeight:40];

代理

/// Return the title for each row in the menu here
/// @param row: the number of row for title
- (nonnull NSString *)rowTitleFor:(NSInteger)row {
    
    return self.menuTitles[row];
}

/// Handle event when user tapped the menu
/// @param row: the number of row that has been tapped
- (void)userDidTapMenu:(NSInteger)row {
    
    MyViewController* vc = [[MyViewController alloc] initWithNibName:nil bundle:nil];
    
    [self.navigationController pushViewController:vc animated:YES];
}

可选代表

/// Return the icon image for each row in the menu here
/// @param row: the number of row for image
- (UIImage *)imageFor:(NSInteger)row{
    
    return self.menuImages[row];
}

/// Return title text font size
/// @param row: the number of row for font size
-(CGFloat) titleFontSizeFor:(NSInteger) row{

    return 12.0;
}

作者

赵越 @ElegantSolution, [email protected]

许可证

ESPopupMenu遵循MIT许可证。有关更多信息,请参阅LICENSE文件。