Latest 0.2.5
Homepage https://github.com/shiyingfeng/NBPopMenu
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

示例图片

image

介绍

NBPopMenu支持弹出框定制.非常方便使用.使用简单.代码块集中.

使用方式

1.最简洁的使用方式
NSArray *arr = @[@"1",@"2",@"3",@"4"];
[NBPopMenu showPopMenuWithItems:arr fromView:sender updateWithConfig:nil clickItem:nil];
2.回调的使用方式
NSArray *arr = @[@"1",@"2",@"3",@"4"];
[NBPopMenu showPopMenuWithItems:arr fromView:sender updateWithConfig:nil clickItem:^(NSInteger index) {
NSLog(@"点击了%zd",index);
}];
3.默认初始化一个选择(需配合使用)
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;
}];
4.通过传入字典弹出popMenu
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]

Latest podspec

{
    "name": "NBPopMenu",
    "version": "0.2.5",
    "summary": "NBPopMenu u5f39u51fau83dcu5355u7c7bu4f3cQQu70b9u51fbu5f39u51fau626bu4e00u626b.",
    "description": "NBPopMenu u8fd9u662fu4e00u4e2au7c7bu4f3cQQu7684u5f39u51fau83dcu5355,u540eu7eedu6709u5f85u6539u8fdb",
    "homepage": "https://github.com/shiyingfeng/NBPopMenu",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "shiyingfeng": "[email protected]"
    },
    "source": {
        "git": "https://github.com/shiyingfeng/NBPopMenu.git",
        "tag": "0.2.5"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "NBPopMenu/Classes/**/*"
}

Pin It on Pinterest

Share This