[翻译] AFDropdownNotification
AFDropdownNotification

Dropdown notification view for iOS.
下拉通知的view,用于iOS.

Installation - 安装
If you're using CocoaPods, just add this line to your Podfile:
如果你正在使用CocoaPods,只要加这么一句话到Podfile中即可:
pod 'AFDropdownNotification', '~> 1.0'
If you're not, import these files to your project:
你可以直接将文件拖到你的项目当中:
AFDropdownNotification.h
AFDropdownNotification.m
Usage - 使用
First of all, init your AFDropdownNotification class and set your main class asAFDropdownNotificationDelegate:
首先,进入AFDropdownNotification这个类,设置你的asAFDropdownNotificationDelegate的代理方法:
AFDropdownNotification *notification = [[AFDropdownNotification alloc] init];
notification.notificationDelegate = self;
You can configure the title text with the titleText property, the subtitle text with subtitleText, an optional left image defined as image, and two optional buttons, with topButtonText andbottomButtonText. For example:
你可以设置titleText的属性值,也可以设置subtitleText的属性值,一个你可以控制是否显示的图片,以及两个可选的按钮,你可以分别设置这两个按钮的文本,例如:
notification.titleText = @"Update available";
notification.subtitleText = @"Do you want to download the update of this file?";
notification.image = [UIImage imageNamed:@"update"];
notification.topButtonText = @"Accept";
notification.bottomButtonText = @"Cancel";
If you want to hide the notification by tapping it, set dimissOnTap to YES:
如果你想在点击了通知后隐藏掉通知,你只需要将dimissOnTap设置成YES即可:
notification.dismissOnTap = YES;
To present it, you can choose if you want to use UIKit dynamics (which will include a subtle bounce) or a regular lineal UIKit animation:
为了要显示出通知的view,你可以使用重力感应的属性(这个会包括一个弹跳的效果)或者是普通的UIKit动画效果:
[notification presentInView:self.view withGravityAnimation:YES];
Finally, to handle the buttons taps, implement the two methods defined by the delegate, -dropdownNotificationTopButtonTapped and -dropdownNotificationBottomButtonTapped.
最后,为了能控制按钮事件,实现下面的两个代理方法即可.
-(void)dropdownNotificationTopButtonTapped {
NSLog(@"Top button tapped");
}
-(void)dropdownNotificationBottomButtonTapped {
NSLog(@"Bottom button tapped");
}
TODO - 待完成事项
- Light theme
- Autolayout support for rotation
License - 协议
AFDropdownNotification is under MIT license so feel free to use it!
Author - 作者
Made by Alvaro Franco. If you have any question, feel free to drop me a line atalvarofrancoayala@gmail.com
[翻译] AFDropdownNotification的更多相关文章
- 《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 ...
随机推荐
- JVM内存限制和调整
今天用java -jar执行一个jar文件提示内存不够,需要设置虚拟机的堆大小.以下是参考资料: 堆(Heap)和非堆(Non-heap)内存 按照官方的说法:“Java 虚拟机具有一个堆,堆是运行 ...
- [POI 2014]RAJ-Rally
Description 题库链接 给定一个 \(N\) 个点 \(M\) 条边的有向无环图,每条边长度都是 \(1\).请找到一个点,使得删掉这个点后剩余的图中的最长路径最短. \(1\leq N\l ...
- Extjs报错处理
错误信息: IE:SCRIPT1009: 缺少 '}' FF: SyntaxError: identifier starts immediately after numeric literal ... ...
- 小白学习之Code First(三)
上下文Context类中的base构造器的几个方法重置(1.无参 2.database name 3 . 连接字符串) 无参:如果基类base方法中无参,code first将会以 :{Namespa ...
- [日常] nginx与location规则
=========================================================================2018年3月28日 记录: location = / ...
- java计算机二级笔记
java.applet.AppletAppletHTMLAppletextends Appletextends AppletprintinitcalendarCalendarCalendar 日历类J ...
- mysql网页客户端工具
mysql数据库的远程管理,云服务器数据库的管理监控等都可以使用 TreeSoft, TreeSoft数据库管理系统使用JAVA开发,采用稳定通用的springMVC +JDBC架构,实现基于WEB ...
- python数据类型之集合
对python中集合的理解 集合是一个无序的,不重复的数据组合,它的主要作用如下: 去重,把一个列表变成集合,就自动去重了 关系测试,测试两组数据之前的交集.差集.并集等关系 常用操作 s = set ...
- BootStrap-select 插件的使用
这是一款下拉框多选的插件,非常的抢到,什么样式都是有的:首先去参看一下官网的信息,详细介绍是怎么使用的: 相关官网网址: https://silviomoreto.github.io/bootstr ...
- Maven 使用 Nexus 内部库 代理
反正任由总理怎么强调,在中国的当前的网络环境下,中央库的访问速度总是令人心碎.建一个nexus内部库可以建立缓存,只要有人通过它下载了相关的maven依赖,那么别人需要时可以马上从本地网络的服务器上返 ...