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. AAAI2019 | 基于区域分解集成的目标检测 论文解读

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

  2. java NIO系列教程2

    7.FileChannel Java NIO中的FileChannel是一个连接到文件的通道.可以通过文件通道读写文件. FileChannel无法设置为非阻塞模式,它总是运行在阻塞模式下. 打开Fi ...

  3. 获得Spring容器

    1. WebApplicationContext wac = ContextLoader.getCurrentWebApplicationCon; 2. ClassPathXmlApplication ...

  4. windows端口查看及进程查找

    1. 使用netstat查看端口 netstat -ano 2. 查找特定端口号: netstat -aon|findstr "port" 3. 查找该端口的进程 tasklist ...

  5. weblogic:local class incompatible: stream classdesc serialVersionUID

    问题:jdk版本不兼容 方法:修改weblogic对应的jdk版本

  6. 在LaTeX中配置西夏文字体与环境

    目录 1 配置字族 2 粗体.斜体设定 3 文本编辑器的字体设定(以Sublime Text为例) 4 附录:一些字体的下载源 警告:这篇文章的部分内容需要西夏文字体才能正常显示.若您需要安装,可参考 ...

  7. Node.js之HTTP请求与响应

    在C#.OC中也是客户端发起一个请求,服务端作出响应.我们可以把这个过程抽象理解 . 1.客户端给服务端发起请求相当于向服务端写入一个流(writable) 2.服务端读取客户端的流(readable ...

  8. [转]How to Create an Add-in for Microsoft Outlook

    本文转自:https://www.codeproject.com/Articles/1112815/How-to-Create-an-Add-in-for-Microsoft-Outlook This ...

  9. SpringMVC 工作原理详解

    本文Github开源项目https://github.com/Snailclimb/JavaGuide,只供自己学习总结无商业用途,如有侵权,联系删除 先来看一下什么是 MVC 模式 MVC 是一种设 ...

  10. spring boot 报错 Failed to read HTTP message

    2008-12-13 15:06:03,930 WARN (DefaultHandlerExceptionResolver.java:384)- Failed to read HTTP message ...