[翻译] 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 ...
随机推荐
- 【云+社区极客说】新一代大数据技术:构建PB级云端数仓实践
本文来自腾讯云技术沙龙,本次沙龙主题为构建PB级云端数仓实践 在现代社会中,随着4G和光纤网络的普及.智能终端更清晰的摄像头和更灵敏的传感器.物联网设备入网等等而产生的数据,导致了PB级储存的需求加大 ...
- haml参考大全
原文来自: http://blackanger.blog.51cto.com/140924/47642 Haml是一种用来描述任何XHTML web document的标记语言,它是干净,简单的. ...
- H5开发中遇到的问题及解决办法
记不得什么时候进行H5开发的学习了,只知道是从2016年8月1日开始修复Bug,计划每天把学到的东西以及遇到问题时候的解决方案都记录下来,希望自己能够坚持下去,每天积累一点,希望有所进步吧. 1.Th ...
- SpringMVC form 表单提交报400错误
错误代码: HTTP Status 400 - type Status report message description The request sent by the client was sy ...
- HTTP报文(面试会问开发时常用的报文头格式)
(本文的解释是完整的,ajax把很多东西封装了) HTTP有两类报文:请求报文和响应报文. HTTP请求报文 一个HTTP请求报文由请求行(request line).请求头部(header).空行和 ...
- office中把标题之后的空格去掉
调整列表缩进--编号之后不特别标注可以把标题之后的空格去掉
- iOS字体打印
//打印所以字体 NSArray *familyNames = [UIFont familyNames]; for(NSString *familyName in familyNames) ...
- 计算机网络:自顶向下方法(第七版)Wireshark实验指南
这本书的每一章后面都提供了一个Wireshark实验,通过使用Wireshark抓包并手动对包进行分析可以帮助我们更好地理解各种协议和相关知识.然而,这个资源在网上好像很难找,我历经千辛万苦找到之后, ...
- java-集合小结
Java集合框架提供了一套性能优良.使用方便的接口和类,包括Collection和Map两大接口,它们都位于 java.util 包中.其中 Collection集合包含两个常 ...
- 使用JSON实现分页
使用JSON实现分页可直接用 Fenye.html <!DOCTYPE html> <html> <head> <title>JSON分页</ti ...