[翻译] CNPPopupController
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
A 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的更多相关文章
- 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...
- 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...
- [翻译]开发文档:android Bitmap的高效使用
内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...
- 【探索】机器指令翻译成 JavaScript
前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...
- 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...
- 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...
- 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...
- 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?
0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...
- ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点
在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...
随机推荐
- 国内maven仓库地址资源汇总
国内maven仓库地址:阿里云maven仓库,网易163maven仓库,以及其他maven仓库地址. 国内下载maven一般速度都很慢,下载需要很久时间.这里汇总了一些国内的镜像资源 附带pom文件中 ...
- java学习-GET方式抓取网页(UrlConnection和HttpClient)
抓取网页其实就是模拟客户端(PC端,手机端...)发送请求,获得响应数据documentation,解析对应数据的过程.---自己理解,错误请告知 一般常用请求方式有GET,POST,HEAD三种 G ...
- elasticsearch(一) 之 elasticsearch初识
目录 一 .elasticsearch 二 . elasticsearch 名词解释 集群(cluster) 节点(node) 索引(index) type(类型) Document(文档) shar ...
- dockerfile基础命令
一直想写一个, 但发现网上有很多了, 直接copy把 如何使用 Dockerfile用来创建一个自定义的image,包含了用户指定的软件依赖等.当前目录下包含Dockerfile,使用命令build来 ...
- 桌面程序开发入门(WinForm with C#)
1.使用Visual Studio 2013创建新项目 2.创建一个主窗体和4个子窗体 3.创建一个数据库.一个表.一个存储过程 4.在配置文件里添加数据库连接字符串 5.真正的编码工作. 第一步:创 ...
- APS审核经验+审核资料汇总——计算机科学与技术专业上海德语审核
1.APS是什么 德国驻华使馆文化处留德人员审核部(简称APS)成立于2001年7月,是由德国驻华使馆文化处和德意志学术交流中心(DAAD)在北京共同合作成立的服务机构. APS是中国学生前往德国留学 ...
- NAS DAS SAN 磁带机 tco
部分摘录自: 百科:http://baike.baidu.com/link?url=7HOH3pJHfaxT-a01T0EhTZBnvvfMoyOZTthUbjMQM85LVxwfFP47YInuo1 ...
- 求最短路径的三种算法: Ford, Dijkstra和Floyd
Bellman-Ford算法 Bellman-Ford是一种容易理解的单源最短路径算法, Bellman-Ford算法需要两个数组进行辅助: dis[i]: 存储顶点i到源点已知最短路径 path[i ...
- composer如何自动验证并获取gitlab的私有库?
近期购买了Laravel的nova以后,需要对它的核心代码做一些修改,为方便与团队其他成员分享,以及在nova官方库更新后方便对差异管理.便将nova库挂在自己的gitlab,通过compos ...
- 【转】Visio绘制WEB流程图的心得
一个哥们在MSN上告诉我,他们公司的交互设计师只产出流程图,并问我用什么标准评价流程图的好坏.他的说法把我彻底震了-这分工也太细了吧!也不知道该说他们那里这样是好还是不好. 不过仔细想来,我倒的确没有 ...