[翻译] 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 ...
随机推荐
- 正则表达式最后的/i是不区分大小写的意思
eg: "/\/*install$/i" 正则表达式 代表什么意思 /表达式的内容/ ,php中的正则表达式都必须在 / / 内 \/是匹配"/" 号,*号 ...
- nginx 学习笔记(6) nginx配置文件中的度量单位
容量大小可以用比特(byte),千比特(kilobyte,后缀k或者K)或者兆(megabytes,后缀m或者M),例如:“1024”,“8k”,“1m”. 时间间隔可以用毫秒(millisecond ...
- H5如何用Canvas画布生成并保存带图片文字的新年快乐的海报
摘要:初略算了算大概有20天没有写博客了,原本是打算1月1号元旦那天写一个年终总结的,博客园里大佬们都在总结过去,迎接将来,看得我热血沸腾,想想自己也工作快2年了,去年都没有去总结一下,今年势必要总结 ...
- Ionic3 UI组件之 ImageLoader
ImageLoader:通过后台线程加载图片(异步)并缓存.类似于Glide或者Picasso. 组件特性: 后台线程下载图片,下载速度更快,不使用webview的资源: 缓存图像.图像将在您下次显示 ...
- jquery序列化from表单使用ajax提交返回json数据(使用struts2注解result type = json)
1.action类引入struts2的"json-default"拦截器栈 @ParentPackage("json-default") //示例 @Paren ...
- CSS3完善和模式
CSS3改善了传统盒模型架构,增强盒子构成要素的功能,扩展了盒模型显示的方式,具体描述如下 改善构造:除了传统的内容区域,边框区,补白区和边界区外,为盒子新增了轮廓区. 增强功能:内容增强CSS自动添 ...
- 使用phpQuery轻松采集网页内容
phpQuery是一个基于PHP的服务端开源项目,它可以让PHP开发人员轻松处理DOM文档内容,比如获取某新闻网站的头条信息.更有意思的是,它采用了jQuery的思想,你可以像使用jQuery一样处理 ...
- hdu 1226
超级密码 Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Subm ...
- redis 批量删除key
redis-cli -h -p keys -p del s
- HTML5 Form Data 对象的使用
HTML5 Form Data 对象的使用 MDN: https://developer.mozilla.org/zh-CN/docs/Web/Guide/Using_FormData_Object ...