• Stars
    star
    193
  • Rank 201,081 (Top 4 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 8 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

一款小巧灵活的自定义弹出视图, 可以做自定义AlertView、弹出窗口等等, A tiny and sweet custom popView (pop popup)

  CocoaPods 

版本记录

  • 1.1.2 修复动画过程中切换视图,导致无法 dismiss 的问题
  • 1.0.9 添加、移除时视图 动画模式下背景渐变,防止屏幕闪一下
  • 1.0.7 解决一个 CoreAnimation 内存泄漏问题
  • 1.0.6 添加阴影、边框粗细、边框颜色等属性(有些 API 名字改了,升级到此版本需要改动一点点原有代码)
  • 1.0.3 支持设置内容相对呼出的位置的上方或者下方,支持自动调整位置
  • 1.0.1 修复 iOS11 下,某些情况不能弹出的 bug

一款自定义 弹出视图

自定义弹出视图,内容支持传一组菜单标题,也支持自定义 view,或者自定义 viewController, 支持任意按钮触发,会显示在按钮底部,也支持切换按钮的对齐方式:左对齐、居中、右对齐

预览图如下

用法

  • 手动下载: CustomPopOverView拖进去
  • Cocoapods: pod 'CustomPopOverView'

自定义 view

CustomPopOverView *view = [CustomPopOverView popOverView];
view.content = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 100, 200)];
view.containerBackgroudColor = [UIColor blueColor];
[view showFrom:_leftBtn alignStyle:CPAlignStyleLeft];


CustomPopOverView *view = [CustomPopOverView popOverView];

UIButton *btn = [UIButton buttonWithType:UIButtonTypeInfoDark];
btn.bounds = CGRectMake(0, 0, 160, 40);
view.content = btn;
[view showFrom:sender alignStyle:CPAlignStyleRight];

自定义 VC

	UIViewController *vc = [[UIViewController alloc]init];
    vc.view.backgroundColor = [UIColor yellowColor];
    vc.view.frame = CGRectMake(0, 0, 200, 200);
    UILabel *lab = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 140, 100)];
    lab.center = vc.view.center;
    lab.text = @"I'm viewController's view";
    lab.numberOfLines = 0;
    [vc.view addSubview:lab];


    CustomPopOverView *view = [CustomPopOverView popOverView];
    view.contentViewController = vc;

    [view showFrom:_rightBtn alignStyle:CPAlignStyleRight];

普通用法(只传一组菜单名称)

	NSArray *menus = @[@"清空已完成", @"清空全部"];
    CPShowStyle *style = [CPShowStyle new];
    style.roundMargin = 5;
    style.triAngelHeight = 0.0;
    style.triAngelWidth = 0.0;
    style.containerCornerRadius = 5.0;
    style.roundMargin = 10.0;
    style.showSpace = 5.f;
    style.containerBackgroudColor = RGBCOLOR(64, 64, 64);
    style.containerBorderColor = UIColor.orangeColor;
    style.containerBorderWidth = 2;


    CustomPopOverView *pView = [[CustomPopOverView alloc]initWithBounds:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width - 40, 300) titleMenus:menus style:style];
    pView.delegate = self;
    [pView showFrom:nil alignStyle:CPAlignStyleRight];

如果你有问题欢迎 issue,希望你能够喜欢


A custom popoverView

This custom popover view, you can give an array of menu titles for normal use. It also support custom view or viewController. It’s frame depends on the button which clicked, and it provides three alignments for the button.

The preview chart is as follows

How to use

custom view

CustomPopOverView *view = [CustomPopOverView popOverView];
view.content = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 100, 200)];
view.containerBackgroudColor = [UIColor blueColor];
[view showFrom:_leftBtn alignStyle:CPAlignStyleLeft];

CustomPopOverView *view = [CustomPopOverView popOverView];

UIButton *btn = [UIButton buttonWithType:UIButtonTypeInfoDark];
btn.bounds = CGRectMake(0, 0, 160, 40);
view.content = btn;
[view showFrom:sender alignStyle:CPAlignStyleRight];

custom viewController

	UIViewController *vc = [[UIViewController alloc]init];
    vc.view.backgroundColor = [UIColor yellowColor];
    vc.view.frame = CGRectMake(0, 0, 200, 200);
    UILabel *lab = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 140, 100)];
    lab.center = vc.view.center;
    lab.text = @"I'm viewController's view";
    lab.numberOfLines = 0;
    [vc.view addSubview:lab];


    CustomPopOverView *view = [CustomPopOverView popOverView];
    view.contentViewController = vc;

    [view showFrom:_rightBtn alignStyle:CPAlignStyleRight];

normal use(only needs an array of titles)

	NSArray *menus = @[@"清空已完成", @"清空全部"];
    CPShowStyle *style = [CPShowStyle new];
    style.roundMargin = 5;
    style.triAngelHeight = 0.0;
    style.triAngelWidth = 0.0;
    style.containerCornerRadius = 5.0;
    style.roundMargin = 10.0;
    style.showSpace = 5.f;
    style.containerBackgroudColor = RGBCOLOR(64, 64, 64);
    style.containerBorderColor = UIColor.orangeColor;
    style.containerBorderWidth = 2;


    CustomPopOverView *pView = [[CustomPopOverView alloc]initWithBounds:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width - 40, 300) titleMenus:menus style:style];
    pView.delegate = self;
    [pView showFrom:nil alignStyle:CPAlignStyleRight];

if you have any question welcome to issue to me,hope you like it!

More Repositories

1

RollingNotice

所有的垂向滚屏这一个库就够了!!!滚动公告、轮播广告,支持灵活自定义cell。淘宝、口碑、京东、美团、天猫等等一切滚动广告 Roll Notice or Advertising, customize cell as UITableViewCell supported, Swift version is also ready
Objective-C
480
star
2

RollingNotice-Swift

滚动公告、广告,支持灵活自定义cell。淘宝、口碑、京东、美团、天猫等等一切滚动广告 Roll Notice or Advertising, customize cell as UITableViewCell supported, Swift version is also ready
Swift
113
star
3

GYIntroductionView

App 启动引导页 新特性介绍 支持自定义每个页面,App launch guide page Introduction to new features
Objective-C
52
star
4

AwesomTemplate

Template
Objective-C
12
star
5

DeviceAuth

设备验证,常见于登录支付等,首先要求TouchID 或 FaceID,可以选择输入设备锁密码
Objective-C
8
star
6

weeklycalendar

calendar
Objective-C
7
star
7

AWActionSheetDemo

自定义actionsheet,内容支持自定义。这里自定义了个分享菜单
Objective-C
6
star
8

Awesome_Swift

swift版的模板项目
Objective-C
3
star
9

StarNight

星空 starry
Objective-C
2
star
10

PreventSameAction

Prevent Repeated Actions within the set time,can be imitated by other languages。在设置的时间内阻止重复的动作,其他语言可以参考
1
star
11

CircleChart

圆圈形图表
Objective-C
1
star
12

MultiDelegateDemo

iOS 多代理的实现
Objective-C
1
star
13

vue-calendar

vue移动端日历,支持vue2、vue3。日历支持单选、多选、按周选、范围选。支持周序显示,支持自定义周开始日
Vue
1
star
14

maltsugar.github.io

my blog website
JavaScript
1
star