Skip to content

wangruofeng/RFPopupMenu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RFPopupMenu

RFPopupMenu is popupMenu is support six pop directions. It is very easy to use!

It supports three types view.

  1. Only a image.
  2. Only a label.
  3. a image on left and a label on right.

Requirements

iOS7.0 and later.

Usage

  1. #import "RFPopupMenu.h".
  2. use + (instancetype)popupMenuWithItems:(NSArray<RFPopupMenuItem *> *)items; or - (instancetype)initWithItems:(NSArray<RFPopupMenuItem *> *)items; to initialize.
  3. set arrowHorizontalOffset if need to adjust arrow's position.
  4. use
- (void)showInView:(UIView *)view
        targetRect:(CGRect)targetRect
      popDirection:(RFMenuPopDirection)direction
          animated:(BOOL)animated;

method to show in a view.

below is sample code

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

(Screenshot)

Download

You can download binary release from the latest releases.

License

RFPopupMenu is released under the MIT license. See LICENSE for details.

About

RFPopupMenu is popupMenu is support six pop directions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published