CNPPopupController

CNPPopupController is a simple and versatile class for presenting a custom popup in a variety of fashions. It includes a many options for controlling how your popup appears and behaves.

Please feel free to contribute to this project, open issues, make suggestions and submit pull-requests. If you use this project in your app, let me know. I'd love to see what you do with it.

CNPPopupController是一个简单的用于提示显示用的view,提供几种流行的显示模式。他包含了很多的设置选项供你定制他的样式。

欢迎你免费使用这个项目,并给我提出需求以及建议,或者自己改进他。如果你的项目中用了这份代码,如果你能告诉我,我将感激不尽。

Installation

Available in Cocoa Pods

pod 'CNPPopupController'

支持Cocoa Pods,

pod 'CNPPopupController' 即可安装

Usage

(See sample Xcode project in /CNPPopupControllerExample)

在Xcode project in /CNPPopupControllerExample查看使用样例

Creating a Popup

Create a popup with custom animations and behaviors. Customizations can also be accessed via properties on the CNPPopupTheme instance:

创建一个popup,支持自定义的动画方式。你可以通过主题实例中的参数来定制样式:

- (instancetype)initWithTitle:(NSAttributedString *)popupTitle
contents:(NSArray *)contents
buttonItems:(NSArray *)buttonItems
destructiveButtonItem:(CNPPopupButtonItem *)destructiveButtonItems;

popupTitle only accepts an NSAtributedString object.

popupTitle只支持富文本对象。

contents only accepts an array of NSAttributedString and UIImage objects.

contents只支持富文本以及图片对象。

buttonItems only accepts an array of CNPPopupButtonItem objects.

buttonItems只支持CNPPopupButtonItem对象数组。

destructiveButtonItem only accepts an CNPPopupButtonItem object.

destructiveButtonItem只支持CNPPopupButtonItem对象。


Note: You may pass nil for any of the initializer properties when creating the popup, but you must assign a theme to the popup before showing it!

A default theme + [CNPPopupTheme defaultTheme] has been created to help you out.

注意:你创建完了popup后,也许会传递nil给某些属性,但是,你必须在显示这个view之前指定一个主题!

一个默认的主题是 + [CNPPopupTheme defaultTheme] ,你可以用这个方法来帮你。


CNPPopupButtonItem allows you to customize the style for each button on a CNPPopupControllerinstance. You may customize button height, color, border width, corner radius, and border color;

CNPPopupButtonItem允许你修改按钮的样式,你可以修改按钮的高度,颜色,边缘厚度,圆角值以及边缘颜色;

Showing a Popup

- (void)presentPopupControllerAnimated:(BOOL)flag;

Dismissing a Popup

- (void)dismissPopupControllerAnimated:(BOOL)flag;

Customization

CNPPopupTheme instance can be created and assigned to the theme property of aCNPPopupController instance.

@property (nonatomic, strong) UIColor *backgroundColor;

@property (nonatomic, assign) CGFloat cornerRadius;

@property (nonatomic, assign) CGFloat preferredPopupWidth;

@property (nonatomic, assign) CGFloat minimumPopupHeight;

@property (nonatomic, assign) UIEdgeInsets popupContentInsets;

@property (nonatomic, assign) CNPPopupStyle popupStyle;

@property (nonatomic, assign) CNPPopupPresentationStyle presentationStyle;

@property (nonatomic, assign) CNPPopupMaskType maskType;

@property (nonatomic, assign) BOOL shouldDismissOnBackgroundTouch;

@property (nonatomic, assign) CGFloat contentVerticalPadding;

@property (nonatomic, assign) UIStatusBarStyle fullscreenStatusBarStyle;

Notes

Deployment

CNPPopupController works on iOS 7 and iOS 8.

CNPPopupController支持iOS7与iOS8

TODO

  • Add 'blur' option for background mask 添加背景模糊效果

[翻译] CNPPopupController的更多相关文章

  1. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  2. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  3. [翻译]开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  4. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

  5. 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

  6. 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

  7. 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...

  8. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?

    0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...

  9. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点

    在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...

随机推荐

  1. 前端通信:ajax设计方案(一)---集成核心请求

    报告,我要说话!xp被历史淘汰了,IE6 say goodbye了,太TM开心了,从此不要兼容IE6了,哈哈哈哈哈哈 报告,我要说话!IE这sb为啥不早点被杀掉呢,找工作听说要兼容IE,立马软了,唉唉 ...

  2. AAAI2019 | 基于区域分解集成的目标检测 论文解读

    Object Detection based on Region Decomposition and Assembly AAAI2019 | 基于区域分解集成的目标检测 论文解读 作者 | 文永亮 学 ...

  3. MySQL 报错MySQL server syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT'

    在hive的应用中,出现如下错误时You have an error in your SQL syntax; check the manual that corresponds to your MyS ...

  4. springboot-17-springboot的文件上传和下载

    单文件上传 1, 需要使用thymeleaf模板:  http://www.cnblogs.com/wenbronk/p/6565834.html src/main/resource/template ...

  5. Verdi文档路径

    1.echo $VERDI_HOME 2.cd $VERDI_HOME/doc 3.okular VerdiTut.pdf& Verdi主要在以下方面使用 Verdi使用情形:        ...

  6. 开源项目Log4j

    一:Log4j入门简介学习 Log4j是Apache的一个开放源代码项目,通过使用Log4j,我们可以控制日志信息输送的目的地是控制台.文件.GUI组件.甚至是套接口服务器.NT的事件记录器.UNIX ...

  7. bet阶段验收互评

    小组名字和链接 优点 缺点,bug报告 最终名次 Gakki赛高[二十四点小游戏] 1.界面与上阶段相比更好了2.新增闯关设计,提升游戏性3.功能完善 1.下载方式不方便2.排行榜设计较为简陋 1 编 ...

  8. Java学习--内置对象(其他的)

  9. 算法:QQ等级换算成皇冠太阳星星月亮

    /// <summary> /// 等级换算成图标分布 /// 以QQ的形式计算 /// 2^(2*0) /1    /// 2^(2*1) /4    /// 2^(2*2) /16   ...

  10. 【转】Apache服务器的下载与安装

    PHP的运行必然少不了服务器的支持,何为服务器?通俗讲就是在一台计算机上,安装个服务器软件,这台计算机便可以称之为服务器,服务器软件和计算机本身的操作系统是两码事,计算机自身的操作系统可以为linux ...