[翻译] 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 ...
随机推荐
- webpack局部安装的问题
webpack的局部安装 npm install webpack 默认状态是当前目录下安装,-g是全局安装 ---------------------------------------------- ...
- centos6 free 和 centos 7的free 的差异与对比
目录 一 centos6 free 常用参数和含义 centos6 free 命令示例 free 值讲解 计算公式 二 centos7 free 常用的参数 centos7 free 命令示例 计算公 ...
- windows server 2012 如何开启 hyper-v 并创建虚拟机
当我们拿到一台新的windows server 2012 服务器的时候,默认hyper-v是没有开启的,如果我们要在windows server上面创建虚拟机,那么我们也就需要开启hyper-v. 开 ...
- springcloud-01-介绍
跟随springcloud的一套视频学习springcloud, 把学到的记录下来, 方便自己, 方便别人 IDE: idea 一个父工程, 其他均为module 父工程的依赖: <parent ...
- Spring 的监听事件 ApplicationListener 和 ApplicationEvent 用法
什么是ApplicationContext? 它是spring的核心,Context我们通常解释为上下文环境,但是理解成容器会更好些. ApplicationContext则是应用的容器. Sprin ...
- Ionic3 UI组件之 ImageLoader
ImageLoader:通过后台线程加载图片(异步)并缓存.类似于Glide或者Picasso. 组件特性: 后台线程下载图片,下载速度更快,不使用webview的资源: 缓存图像.图像将在您下次显示 ...
- PHP 类与对象 全解析( 一)
目录 PHP 类与对象 全解析( 一) PHP 类与对象 全解析( 二) PHP 类与对象 全解析(三 ) 1.类与对象 对象:实际存在该类事物中每个实物的个体.$a =new User(); 实例化 ...
- 工程中添加工程依赖 Xcode iOS
有时我们需要在一个主工程中添加其他的子工程,用来对子工程进行编写修改或者是利用子工程中的库文件等等操作,这时候我们需要用到工程的嵌套. 步骤:(看图说话) 1.新建主工程,名为TestTTTT ...
- Java基础教程(19)--Object类
Object类位于类结构树的最顶端,所有的类都是它的直接或间接子类,因此所有的类都继承了Object类的方法,我们可以在需要的时候覆盖这些方法.下面是一些将会在本文中讨论的Object类的方法: ...
- SpringBoot+Swagger2 整合
SpringBoot+Swagger2四步整合 第一步:添加相关依赖 <parent> <groupId>org.springframework.boot</groupI ...