TSActivityIndicatorView 自定义指示器

https://github.com/tomkowz/TSActivityIndicatorView

TSActivityIndicatorView

This is very simple view class that looks like an UIActivityIndicatorView but is fully customizable. It's great for you if you want to add indicator view to you game or app and it should be customized. If you use this class you can not only make circular Indicators, you can add images that are wide and have e.g. 3 rotating balls etc. (instead of one object which rotate in native UIActivityIndicator).

这是一个非常简单的view类,看起来像UIActivityIndicatorView并能完全的定制.如果你想定制UIActivityIndicatorView,那它非常有用.你还可以用图片来定制它哦.

Why should i use it?

As I mentioned earlier, if you want to have nice looking indicator view, use this class.

正如我说的那样,你想你的UIActivityIndicatorView好看点,就用这个类.

Is it better than animated UIImageView?

Yes. You can use it in very simple way in Interface Builder. You only have to pass images names in keyPath and that's all. Look below.

对的,你可以在IB中使用它.你只需要在keyPath中传递图片的名字,that's all.

How can i use it? Is it difficult?

There are two ways to use it and both are simple. Sounds good, ha?

有两种方式可以是哦那个,很简单滴.

Fully programically

First things first. You have to import class.

首先,你得先引入类.

  1. #import "TSActivityIndicatorView.h"

Next thing to do is create instance.

然后,创建出实例对象.

  1. TSActivityIndicatorView *customIndicator =
  2. [[TSActivityIndicatorView alloc] initWithFrame:CGRectMake(160-17, 100, 35, 35)];

Then you have to import images to your project and add titles to the frames property as an NSArray object.

之后,你需要将图片名赋值给NSArray即可.

  1. customIndicator.frames = @[@"activity-indicator-1",
  2. @"activity-indicator-2",
  3. @"activity-indicator-3",
  4. @"activity-indicator-4",
  5. @"activity-indicator-5",
  6. @"activity-indicator-6"];

Next you may set duration time of whole animation.

然后,你设置下完整动画的时间.

  1. customIndicator.duration = 0.5f; /// Default is 1.0f

Penultimate step is to run this indicator.

倒数第二步是让他跑起来.

  1. [customIndicator startAnimating];

And after your things are done, stop indicator it by calling stopAnimating

等你的活干完了,让它停下来.

  1. [customIndicator stopAnimating];

Both startAnimating and stopAnimating methods are executed in Main Thread.

注意:startAnimating以及stopAnimating都是在主线程中运行的哦.

[翻译] TSActivityIndicatorView 自定义指示器的更多相关文章

  1. Android自定义指示器时间轴

    指示器时间轴在外卖.购物类的APP里会经常用到,效果大概就像下面这样,看了网上很多文章,大都是自己绘制,太麻烦,其实通过ListView就可以实现.   在Activity关联的布局文件activit ...

  2. 【翻译】自定义 UIViewController Transitions

    原文地址:http://www.shinobicontrols.com/blog/posts/2013/10/03/ios7-day-by-day-day-10-custom-uiviewcontro ...

  3. SAP CRM 自定义控制器与数据绑定

    当用户从视图离开时,视图将失去它的数据.解决这个问题,需要引入自定义控制器(Custom Controller)(译者注:SAP CRM自定义端中,不同地方的Custom Controller会翻译为 ...

  4. react-native-page-scrollview 的使用方法(实现酷炫的分页轮播效果,还支持自定义View)

    react-native-page-scrollview 对ScrollView的封装,可以很方便的实现水平,垂直分页轮播效果.而且可以自定义分页宽高,和侧边View的旋转,透明度,大小等. 对于原生 ...

  5. 掘金 Android 文章精选合集

    掘金 Android 文章精选合集 掘金官方 关注 2017.07.10 16:42* 字数 175276 阅读 50053评论 13喜欢 669 用两张图告诉你,为什么你的 App 会卡顿? - A ...

  6. servlet&jsp高级:第三部分

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  7. Orchard官方文档翻译(一) 总览

    原文地址:http://docs.orchardproject.net/ 最近想要学习了解orchard,但却没有找到相关的中文文档,只有英文文档.于是决定自行翻译,以便日后方便翻阅. 转载请注明原作 ...

  8. Flex4/Flash多文件上传(带进度条)实例分享

    要求 必备知识 本文要求基本了解 Adobe Flex编程知识和JAVA基础知识. 开发环境 MyEclipse10/Flash Builder4.6/Flash Player11及以上 演示地址 演 ...

  9. Android ExpandableListView的技巧和问题

    前言: 最近一个多月在认真的学习Android和做项目,文章内容表达的不好或者理解错了,希望大家评论指出. :-) 本文是总结几个比较常用且使用的技巧,和一个大家都会遇到的问题. 文章中大部分语句摘抄 ...

随机推荐

  1. ios app应用在显示屏幕上改中文名

    1.点击项目名 2.选Build settings 搜索 product name 3.双击,改为需要在手机上显示的应用名

  2. 【hdoj_1002】A+B Problem ||(大数)

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=1002 题目提示,相加的两个数的位数可能很大(最多可达1000位),而int最多32位,long long类 ...

  3. MVC – 5.MVC设计模式和.NetMVC框架

    MVC模式-设计模式 •控制器(Controller)- 负责转发请求,对请求进行处理. •视图 (View) - 界面设计人员进行图形界面设计. •模型 (Model)-业务逻辑.数据.验证规则.数 ...

  4. Ubuntu16.4 zookeeper-3.4.10 单机多实例部署

    上传 zookeeper-3.4.10.tar.gz 到服务器 root@temple-:/usr/local/temple/jar# ll total drwxr-xr-x root root 8月 ...

  5. java SE :标准输入/输出

    一 标准设备输入/输出 A 标准输入/输出类 System B 控制台读写类 Console  标准输入/输出类  System 1 标准输入.标准输出.错误输出流 // 标准输入流 public f ...

  6. C# 使用UDP组播实现局域网桌面共享

    最近需要在产品中加入桌面共享的功能,暂时不用实现远程控制:参考了园子里的一些文章,加入了一些自己的修改. 需求:将一台机器的桌面通过网络显示到多个客户端的屏幕上,显示内容可能为PPT,Word文档之类 ...

  7. js获取URL中指定的值

    function getSearchString(key) { // 获取URL中?之后的字符 var str = location.search; str = str.substring(1,str ...

  8. BZOJ4653 [NOI2016]区间 [线段树,离散化]

    题目传送门 区间 Description 在数轴上有 n个闭区间 [l1,r1],[l2,r2],...,[ln,rn].现在要从中选出 m 个区间,使得这 m个区间共同包含至少一个位置.换句话说,就 ...

  9. svn代码同步脚本

    碰到一个需求,主要是2个项目需要用到同一份代码,主要是域名和配置信息不一样,而且要把svn更新的代码同步过去.本来考虑提交时用钩子同步过去,但考虑到同步过去的代码还需要测试,而且另一边代码的时效性不强 ...

  10. 在phpWeChat里生成一个临时二维码(非微信二维码)

    phpWeChat作为支持Pc+H5开发的管理系统,内置一套二维码生成API,访问地址: 您的域名/api/qrcode/index.php?data=二维码数据 以下为使用示例 使用时有一点需要注意 ...