All Projects → tomkowz → Tsactivityindicatorview

tomkowz / Tsactivityindicatorview

Licence: mit
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.

image

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).

Why should i use it?

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

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.

How can i use it? Is it difficult?

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

1. 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.

    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.

2. In Interface Builder

First thing to do is add View to your ViewController and set it's size. I prefer 35 by 35 pixels. Then you have to set the class of this view. Set TSActivityIndicatorView. image

And the most important thing to do, you have to type images names (required) and optionally you can set duration of animation (default set to 1.0), and hidesWhenStopped property (default set to YES). image

Next step is to create outlet and call startAnimation and whenever you need.

If you have a question, feel free to mail me or mention me @tomkowz.

Enjoy!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].