[翻译] 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都是在主线程中运行的哦.

 

 

 

目录
相关文章
|
C++ 小程序
VC编程中如何设置对话框的背景颜色和静态文本颜色
晚上编一个小程序,涉及到如何设置对话框的背景颜色和静态文本颜色。这在VC6.0中本来是一句话就搞定的事。在应用程序类中的InitInstance()函数添加:     //设置对话框背景和文本颜色 SetDialogBkColor(RGB(160,180,220),RGB(0,0,0));   谁知这在VS 2005上竟不起作用,到网上一查,原来SetDialogBkColor函数在VS 2003中就已经不支持了。
1227 0
静态文本显示图标图片
1.首先在界面上放置一个static text 控件 2.修改它的ID,并添加其控件成员变量CStatic m_staticIcon; 3.编写函数:
764 0
|
API 定位技术
【百度地图API1.1】修改文本标注的样式
原文:【百度地图API1.1】修改文本标注的样式 百度地图API1.0中文本标注的样式写法为: label.getDom().style.borderColor = "#808080"; label.
1389 0
zotero翻译、界面、笔记字体大小设置
zotero翻译、界面、笔记字体大小设置
zotero翻译、界面、笔记字体大小设置
QGS
|
监控
解决Zabbix5.0.8图形无法显示(中英文)图片文字标签
记解决Zabbix5.0.8图形无法显示(中英文)图片文字标签
QGS
503 0
解决Zabbix5.0.8图形无法显示(中英文)图片文字标签
|
C#
WPF文字描边的解决方法(二)——支持文字竖排和字符间距调整
原文:WPF文字描边的解决方法(二)——支持文字竖排和字符间距调整 自前天格式化文本效果出来后,今天又添加文本竖排和调整字符间距的功能。
1823 0
|
API 开发工具 C#
C#使用原生方法将文字朗读出来
C#使用原生方法将文字朗读出来
241 0
|
C#
WPF文字修饰——上、中、下划线与基线
我们知道,文字的修饰包括:空心字、立体字、划线字、阴影字、加粗、倾斜等。这里只说划线字的修饰方式,按划线的位置,我们可将之分为:上划线、中划线、基线与下划线。如图: 从上至下,分别为上划线(Overline),中划线(StrikeThrough),基线(Baseline)和下划线(Underline)。
924 0

热门文章

最新文章