RFPopupMenu is popupMenu is support six pop directions. It is very easy to use!
- Only a image.
- Only a label.
- a image on left and a label on right.
iOS7.0 and later.
#import "RFPopupMenu.h"
.- use
+ (instancetype)popupMenuWithItems:(NSArray<RFPopupMenuItem *> *)items;
or- (instancetype)initWithItems:(NSArray<RFPopupMenuItem *> *)items;
to initialize. - set
arrowHorizontalOffset
if need to adjust arrow's position. - use
- (void)showInView:(UIView *)view
targetRect:(CGRect)targetRect
popDirection:(RFMenuPopDirection)direction
animated:(BOOL)animated;
method to show in a view.
RFPopupMenuItem *item1 = [[RFPopupMenuItem alloc] initWithTitle:@"扫一扫" image:[UIImage imageNamed:@"scan"] target:self action:@selector(itemClicked:)];
RFPopupMenuItem *item2 = [[RFPopupMenuItem alloc] initWithTitle:@"加好友" image:[UIImage imageNamed:@"add"] target:self action:@selector(itemClicked:)];
RFPopupMenuItem *item3 = [[RFPopupMenuItem alloc] initWithTitle:@"创建讨论组" image:[UIImage imageNamed:@"chat"] target:self action:@selector(itemClicked:)];
RFPopupMenuItem *item4 = [[RFPopupMenuItem alloc] initWithTitle:@"发送到电脑" image:[UIImage imageNamed:@"computer"] target:self action:@selector(itemClicked:)];
RFPopupMenuItem *item5 = [[RFPopupMenuItem alloc] initWithTitle:@"面对面传" image:[UIImage imageNamed:@"change"] target:self action:@selector(itemClicked:)];
RFPopupMenuItem *item6 = [[RFPopupMenuItem alloc] initWithTitle:@"收钱" image:[UIImage imageNamed:@"money"] target:self action:@selector(itemClicked:)];
self.popupMenu = [[RFPopupMenu alloc] initWithItems:@[item1, item2, item3, item4, item5, item6]];
self.popupMenu.arrowHorizontalOffset = 90.f;
[self.popupMenu showInView:self.view targetRect:_button3.frame popDirection:RFMenuPopDirectionTopRight animated:YES];
##Screenshot
You can download binary release from the latest releases.
RFPopupMenu is released under the MIT license. See LICENSE for details.