Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mownier/monactivityindicatorview
MONActivityIndicatorView is an awesome custom activity indicator view for iOS.
https://github.com/mownier/monactivityindicatorview
objective-c uiactivityindicatorview
Last synced: 5 days ago
JSON representation
MONActivityIndicatorView is an awesome custom activity indicator view for iOS.
- Host: GitHub
- URL: https://github.com/mownier/monactivityindicatorview
- Owner: mownier
- License: mit
- Created: 2014-04-24T02:53:02.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2018-07-27T12:23:04.000Z (over 6 years ago)
- Last Synced: 2024-04-20T14:23:08.478Z (10 months ago)
- Topics: objective-c, uiactivityindicatorview
- Language: Objective-C
- Homepage:
- Size: 577 KB
- Stars: 329
- Watchers: 12
- Forks: 55
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# MONActivityIndicatorView
MONActivityIndicatorView is an awesome custom activity indicator view for iOS.
![MONActivityIndicatorView] (https://raw.github.com/mownier/MONActivityIndicatorView/master/MONActivityIndicatorView-Screenshot.gif)
## Installation
### Manual Install
* Copy and add the files `MONActivityIndicatorView.h` and `MONActivityIndicatorView.m` to your project.
* Add the **QuartzCore** framework to your project.
* Then do, `import MONActivityIndicatorView.h`### From CocoaPods
* Add `pod 'MONActivityIndicatorView'` to your Podfile.
* Then `pod install` in the terminal.## Usage
### Initialization
``` objective-c
- (void)viewDidLoad {
[super viewDidLoad];MONActivityIndicatorView *indicatorView = [[MONActivityIndicatorView alloc] init];
[self.view addSubview:indicatorView];
}
```### Toggling Indicator
``` objective-c
[indicatorView startAnimating];
[indicatorView stopAnimating];
```## Customization
### Default Property Values
* Animation delay : `delay = 0.2`
* Animation duration : `duration = 0.8`
* Number of circles : `numberOfCircles = 5`
* Circle's radius : `radius = 10`
* Circle's internal spacing : `internalSpacing = 5`
* Circle's background Color : `defaultColor = [UIColor lightGrayColor]`### Custom Property Values
``` objective-c
- (void)viewDidLoad {
[super viewDidLoad];
MONActivityIndicatorView *indicatorView = [[MONActivityIndicatorView alloc] init];
indicatorView.numberOfCircles = 3;
indicatorView.radius = 20;
indicatorView.internalSpacing = 3;
indicatorView.duration = 0.5;
indicatorView.delay = 0.5
indicatorView.center = self.view.center;
[self.view addSubview:indicatorView];
[indicatorView startAnimating];
}
```### Custom Circle's Background Color
First, assign the `MONActivityIndicatorViewDelegate` protocol to a view controller. Then, implement the method `activityIndicatorView:circleBackgroundColorAtIndex:`
``` objective-c
@interface ViewController : UIViewController@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
MONActivityIndicatorView *indicatorView = [[MONActivityIndicatorView alloc] init];
indicatorView.delegate = self;
indicatorView.numberOfCircles = 3;
indicatorView.radius = 20;
indicatorView.internalSpacing = 3;
indicatorView.duration = 0.5;
indicatorView.delay = 0.5
indicatorView.center = self.view.center;
[self.view addSubview:indicatorView];
[indicatorView startAnimating];
}- (UIColor *)activityIndicatorView:(MONActivityIndicatorView *)activityIndicatorView
circleBackgroundColorAtIndex:(NSUInteger)index {
// For a random background color for a particular circle
CGFloat red = (arc4random() % 256)/255.0;
CGFloat green = (arc4random() % 256)/255.0;
CGFloat blue = (arc4random() % 256)/255.0;
CGFloat alpha = 1.0f;
return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
}@end
```