TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Mar 2017 |
Maintained by Dario Trisciuoglio.
FLLActivityIndicatorController
is an iOS class that displays an indicator while work is being done in a background thread.
To run the example project, clone the repo, and run pod install
from the Example directory first.
FLLActivityIndicatorView
// Initialize the activity indicator view
CGRect frame = CGRectMake(40, 40, 40, 40);
FLLActivityIndicatorView *activityIndicatorView = [[FLLActivityIndicatorView alloc] initWithFrame:frame];
// Set the line width of the activity indicator view
activityIndicatorView.lineWidth = 4;
// Set the stroke color of the activity indicator view
activityIndicatorView.strokeColor = [UIColor redColor];
// Add it as a subview
[self.view addSubview:activityIndicatorView];
...
// Start animation
[activityIndicatorView startAnimating];
...
// Stop animation
[activityIndicatorView stopAnimating];
FLLActivityIndicatorController
// Create the NSURLSessionConfiguration and then create a session with that configuration.
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];
// Create the NSURLRequest using either an NSURL
NSURL *url = [NSURL URLWithString:@"https://httpbin.org/get"];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
// Initialize the shared instance activity indicator controller.
FLLActivityIndicatorController *activityIndicatorController = [FLLActivityIndicatorController activityIndicatorController];
// Show the activity indicator
[activityIndicatorController show];
// Call the web service
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
// Hide the activity indicator
[activityIndicatorController hide];
}];
[dataTask resume];
Also support xib and storyboard
The lineWidth
and strokeColor
properties can even be set after animating has been started, which you can observe in the included example project.
CocoaPods
Dario Trisciuoglio, [email protected]
FLLActivityIndicatorController is available under the MIT license. See the LICENSE file for more info.