[翻译] 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 ...
随机推荐
- Nginx反向代理实现会话(session)保持的两种方式 (转)
http://blog.csdn.net/gaoqiao1988/article/details/53390352 一.ip_hash: ip_hash使用源地址哈希算法,将同一客户端的请求总是发往同 ...
- java Html 转 PDF
Html 转 PDF 使用 flying-saucer 插件来完成 导入flying-saucer依赖 <dependency> <groupId>org.xhtmlrende ...
- [BZOJ 5074]小B的数字
Description 题库链接 给你一个长度为 \(n\) 的序列 \(a_1,a_2,\cdots,a_n\) ,让你生成另一个序列 \(b_1,b_2,\cdots,b_n\) ,使得 \(\f ...
- WCF DEMO1 创建自托管宿主
using System; using System.ServiceModel; using System.ServiceModel.Channels; //注意:需要引用程序集 System.Ser ...
- spring jpa和mybatis整合
spring jpa和mybatis整合 前一阵子接手了一个使用SpringBoot 和spring-data-jpa开发的项目 后期新加入一个小伙伴,表示jpa相比mybatis太难用,多表联合的查 ...
- github 上如何直接预览仓库中的html,搭建自己的主页
前言:最近在写vue+element ui 的一些demo,就在github上建了个仓库来管理,但是希望能直接在github上就能预览效果,所以才有了这篇文章.转载请注明出处:https://www. ...
- 您可能不知道的CSS元素隐藏“失效”以其妙用——张鑫旭
一.CSS元素隐藏 在CSS中,让元素隐藏(指屏幕范围内肉眼不可见)的方法很多,有的占据空间,有的不占据空间:有的可以响应点击,有的不能响应点击.后宫选秀——一个一个看. { display: non ...
- Debian Gun/linux基本用法
添加软件源:vim /etc/apt/sources.list 在文本中添加如下内容:deb http://mirrors.163.com/debian/ stretch main non-free ...
- PHP的new self() 与new static()
参考链接:[PHP中new static()与new self()的区别异同分析],[PHP中new self()和new static()的区别探究],[PHP中static和self的区别] 要点 ...
- html打造动画【系列2】- 可爱的蛙蛙表情
先感受一下全部表情包: 在开始之前先安利一个知识点:Flex弹性布局 我们一般做水平三列布局都是用的float方法,将每一块浮动显示在同一行.这种方法会导致元素没有原来的高度属性,要用清除浮动来解决空 ...