测试已测试 | ✗ |
Lang语言 | Obj-CObjective C |
许可协议 | MIT |
Released最后发布 | 2017年3月 |
由 Dario Trisciuoglio 维护。
FLLActivityIndicatorController
是一个 iOS 类,用于在后台线程中执行工作时显示指示器。
要运行示例项目,克隆仓库,然后首先从 Example 目录中运行 pod install
。
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];
也支持 xib 和 storyboard
即使动画已经开始,也可以设置 lineWidth
和 strokeColor
属性,这在包含的示例项目中可以观察到。
CocoaPods
Dario Trisciuoglio, [email protected]
FLLActivityIndicatorController 按照MIT许可证提供。查看 LICENSE 文件了解更多信息。