[翻译] TSActivityIndicatorView 自定义指示器

简介:

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.

首先,你得先引入类.

#import "TSActivityIndicatorView.h"

Next thing to do is create instance.

然后,创建出实例对象.

    TSActivityIndicatorView *customIndicator = 
    [[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即可.

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

Next you may set duration time of whole animation.

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

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

Penultimate step is to run this indicator.

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

    [customIndicator startAnimating];

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

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

    [customIndicator stopAnimating];

Both startAnimating and stopAnimating methods are executed in Main Thread.

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

 

 

 

目录
相关文章
|
4月前
|
JavaScript 前端开发 定位技术
HTML新特性【账号和获取密钥、初始化、变更地图类型、添加控件、改变控件位置、添加覆盖物、自定义标注图标、添加文本标注】(四)-全面详解(学习总结---从入门到深化)(上)
HTML新特性【账号和获取密钥、初始化、变更地图类型、添加控件、改变控件位置、添加覆盖物、自定义标注图标、添加文本标注】(四)-全面详解(学习总结---从入门到深化)
36 0
|
5月前
微信小游戏制作工具中文字设置的粗体不显示,怎么解决?
微信小游戏制作工具中文字设置的粗体不显示,怎么解决?
41 1
|
5月前
|
文字识别 JavaScript API
Vue实现:Ctrl+V粘贴文字图片截图,调用第三方API文字识别OCR内容并进行内容分割识别填充。
Vue实现:Ctrl+V粘贴文字图片截图,调用第三方API文字识别OCR内容并进行内容分割识别填充。
Vue实现:Ctrl+V粘贴文字图片截图,调用第三方API文字识别OCR内容并进行内容分割识别填充。
|
Java
全网首发:JDK绘制文字:六、字符对应的字体图像加载流程
全网首发:JDK绘制文字:六、字符对应的字体图像加载流程
74 0
zotero翻译、界面、笔记字体大小设置
zotero翻译、界面、笔记字体大小设置
zotero翻译、界面、笔记字体大小设置
|
Linux Python
Python编程:colorama给控制台文本增加颜色
Python编程:colorama给控制台文本增加颜色
Python编程:colorama给控制台文本增加颜色
|
文字识别 Python wax
Python 绘图字体控制 + 文字在图片中的位置调整
Python 绘图字体控制 + 文字在图片中的位置调整
1100 0
PyQt5 技术篇-plainTextEdit控件获得文本内容方法、设置文本内容方法。
PyQt5 技术篇-plainTextEdit控件获得文本内容方法、设置文本内容方法。
684 0
Word文档中插入的图片显示不全、嵌入式图片显示不全解决方法,仅设置图片为单倍行距方法
Word文档中插入的图片显示不全、嵌入式图片显示不全解决方法,仅设置图片为单倍行距方法
654 0
Word文档中插入的图片显示不全、嵌入式图片显示不全解决方法,仅设置图片为单倍行距方法
|
Java BI 开发者
生成图片(VerifyCode 类)|学习笔记
快速学习生成图片(VerifyCode 类)
158 0
生成图片(VerifyCode 类)|学习笔记