[翻译] BTSimpleRippleButton
BTSimpleRippleButton
https://github.com/balram3429/btSimpleRippleButton
This is a custom button for iOS with Ripple effect. It is simple to integrate & customizable component. Suppors callback using blocks.
这是一个自定义的button,带有波纹效果.这是一个很容易使用并定制的组件,支持block回调.
Requirements
- Xcode 5 or higher Xcode 5以及以上
- Apple LLVM compiler Apple LLVM 编译器
- iOS 7.1 or higher iOS 7.1 及以上
- ARC ARC
Demo
Build and run the BTSimpleRippleButton
project in Xcode to see BTRippleButtton
in action.
编译以及运行这个demo项目来看看效果.
Installation
- Drag the file
btRippleButtton.h / btRippleButtton.m
to your project. Alternatively you can add the folderbtRippleButton
to your project. 将btRippleButtton.(h/m)文件拖入到你的项目当中 - Maken an import statement for the file as
#import"BTRippleButtton.h"
. 引入头文件 - Add to your project the
QuartzCore framework
make an import statement for it. 添加QuartzCore framework框架
Initialization
To go with a simple initialization, use the below method. Provide an image, frame size, the target method & the sender view.
你可以进行简易的初始化,使用以下的方法,提供一张 image, frame size,以及目标
BTRippleButtton *rippleButton = [[BTRippleButtton alloc]initWithImage:[UIImage imageNamed:@"pin.png"]
andFrame:CGRectMake(144, 55, 32, 32)
andTarget:@selector(buttonTapped:)
andID:self];
[rippleButton setRippeEffectEnabled:YES];
[rippleButton setRippleEffectWithColor:[UIColor colorWithRed:240/255.f green:159/255.f blue:10/255.f alpha:1]];
[self.view addSubview:rippleButton];
Block based call back
For block based initialization to enable call back, use the below simple method.
基于block方式的回调,使用以下方法
BTRippleButtton *rippleButtonGreen = [[BTRippleButtton alloc] initWithImage:[UIImage imageNamed:@"author.png"]
andFrame:CGRectMake(110, 300, 99, 99)
onCompletion:^(BOOL success) { // add here more code to block
NSLog(@"I am from Block, execution."); }]; [rippleButtonGreen setRippeEffectEnabled:YES];
[rippleButtonGreen setRippleEffectWithColor:[UIColor colorWithRed:204/255.f green:270/255.f blue:12/255.f alpha:1]];
[self.view addSubview:rippleButtonGreen];
[翻译] BTSimpleRippleButton的更多相关文章
- 《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 ...
随机推荐
- Django配置celery执行异步任务和定时任务
原生celery,非djcelery模块,所有演示均基于Django2.0 celery是一个基于python开发的简单.灵活且可靠的分布式任务队列框架,支持使用任务队列的方式在分布式的机器/进程/线 ...
- centos6.5 + 7 静态ip配置
2017/09/19日更, centos6.5 可用 DEVICE=eth0 TYPE=Ethernet ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=static D ...
- Nginx(一)安装及启停
目录 1 nginx安装 2 nginx启停 我发现很多博客排版杂乱,表达不清,读者看了往往云里雾里.我此前的博客也是如此,我自己很不满意.今起,每一篇博客都会用心写,此前的博客我也会尽力修改.至少要 ...
- rails常用验证方法
validates_presence_of :login, :message => "用户名不能为空!" validates_length_of ...
- [PY3]——对iterator的处理(解析式、map、reduce、filter)
引言 对iterator一般可以用for in方法处理,但有时可以借助更高效.也更易读的方式去处理. 例如解析式(包括列表解析式.生成器解析式.集合解析式.字典解析式), 例如map( ).reduc ...
- ionic中generate page后module.ts报错的解决办法
此问题出现在Ionic官方将版本从2.2升级到Ionic3以上之后, 在项目中generate page时,自动创建的module.ts就报错,如下: 解决办法如下: 1)将IonicModule替换 ...
- Python__组合数据类型
组合数据:集合类型.序列类型(元组类型.列表类型).字典类型 集合: 定义:集合是多个元素的无序组合.(无序,唯一,Python中要求放入集合中的数据类型是不可变的). 集合用大括号 {}表示,元素间 ...
- 深入理解MyBatis的原理:整个体系
前言:工作中虽然用到了 MyBatis,可完全不知道为什么,再不学习就晚了,这里将记录我的学习笔记,整个 MyBatis 的体系. 一.简介 1.传统的JDBC JDBC 是一种典型的桥接模式. 使用 ...
- Intellij IDEA run coverage之覆盖率测试
Intellij IDEA run coverage之覆盖率测试 idea 的coverage + 我们自己写的测试用例.最后看一下,我们要测的代码有没有测试到,这是一个不错的提高代码质量的方法. i ...
- Java对象的内存(一)
前言 新人一枚,刚刚入门编程不久,各方面都在学习当中,博文有什么错误的地方,希望我们可以多多交流! 最近,在开发App后台过程中,需要将项目部署到云服务器上.而云服务器的内存大小却只有1G.要如何做到 ...