TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2017 |
Maintained by shiyingfeng.
NBPopMenu支持弹出框定制.非常方便使用.使用简单.代码块集中.
NSArray *arr = @[@"1",@"2",@"3",@"4"];
[NBPopMenu showPopMenuWithItems:arr fromView:sender updateWithConfig:nil clickItem:nil];
NSArray *arr = @[@"1",@"2",@"3",@"4"];
[NBPopMenu showPopMenuWithItems:arr fromView:sender updateWithConfig:nil clickItem:^(NSInteger index) {
NSLog(@"点击了%zd",index);
}];
static NSInteger ind = 2;
NSArray *arr = @[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10"];
UITouch *t = touches.anyObject;
CGPoint p = [t locationInView: self.view];
[NBPopMenu showPopMenuWithItems:arr fromPoint:p updateWithConfig:^(NBPopMenuConfig *config) {
config.popMenuVisibleItemCount = 4;
config.popMenuOffset = 5;
config.popMenuSelectIndex = ind;
config.popMenuSelectedBgColor = [UIColor yellowColor];
} clickItem:^(NSInteger index) {
ind = index;
}];
NSDictionary *itemDict = @{@"发起群聊":@"chat_img_groupchat",
@"添加朋友":@"home_img_my",
@"扫一扫":@"home_img_scan"
};
[NBPopMenu showPopMenuWithDict:itemDict fromPoint:sender.center updateWithConfig:^(NBPopMenuConfig *config) {
config.popMenuBackgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
config.popMenuTextColor = [UIColor whiteColor];
} clickItem:^(NSInteger index) {
NSLog(@"点击了%zd",index);
}];
NBPopMenu 可以通过Pods安装 CocoaPods.
pod 'NBPopMenu'
左手边是幸福, [email protected]