项目作者: hassan8357

项目描述 :
Custom loading indicator with animation.
高级语言: Objective-C
项目地址: git://github.com/hassan8357/VZLoadingIndicator.git
创建时间: 2017-07-31T13:23:48Z
项目社区:https://github.com/hassan8357/VZLoadingIndicator

开源协议:MIT License

下载


VzLoadingIndicator

=======================

Build Status
Cocoapods Compatible

Introduction

VzLoadingIndicator is a custom loading indicator with animation.

Demo

alt tag

Installation

Cocoapods

Install Cocoapods if need be.

  1. $ gem install cocoapods

Add VZLoadingIndicator in your Podfile.

  1. use_frameworks!
  2. pod 'VZLoadingIndicator'

Add source URLs

  1. source 'https://github.com/CocoaPods/Specs.git'
  2. source 'https://github.com/hassan8357/VZLoadingIndicator.git’

Then, run the following command.

  1. $ pod install

Example usage

import VZLoadingIndicatorView & UIWindow+Additions in AppDelegate

  1. #import "VZLoadingIndicatorView.h"
  2. #import "UIWindow+Additions.h"

define sharedAppDelegate

  1. #define appDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])

create loadingView

  1. @property (strong, nonatomic) VZLoadingIndicatorView *loadingView;

Add start method and end methods in app delegate to add/remove loadingView to current visable view

  1. - (void)startActivityIndicator{
  2. if (!appDelegate.loadingView)
  3. {
  4. [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];
  5. appDelegate.loadingView = [[VZLoadingIndicatorView alloc] init];
  6. [appDelegate.loadingView setImagesArray:@[@"L.png", @"L2.png",@"L3.png", @"L4.png",@"L5.png", @"L6.png", @"L7.png"]];
  7. UIViewController *visibleViewController = [self.window visibleViewController];
  8. UIViewController *viewController = visibleViewController;
  9. if (visibleViewController.navigationController)
  10. {
  11. visibleViewController.navigationController.interactivePopGestureRecognizer.enabled = NO;
  12. viewController = visibleViewController.navigationController;
  13. }
  14. CGRect frame = viewController.view.frame;
  15. frame.size.width = viewController.view.frame.size.width ;
  16. frame.size.height = viewController.view.frame.size.height;
  17. frame.origin.x = 0;
  18. frame.origin.y = 0;
  19. appDelegate.loadingView.frame = frame;
  20. [viewController.view addSubview: appDelegate.loadingView];
  21. [appDelegate.loadingView startAnimation];
  22. }
  23. }
  1. - (void)stopActivityIndicator{
  2. UIViewController *visibleViewController = [self.window visibleViewController];
  3. UIViewController *viewController = visibleViewController;
  4. if (visibleViewController.navigationController) {
  5. visibleViewController.navigationController.interactivePopGestureRecognizer.enabled = YES;
  6. viewController = visibleViewController.navigationController;
  7. }
  8. if (appDelegate.loadingView) {
  9. [appDelegate.loadingView stopAnimation];
  10. [appDelegate.loadingView removeFromSuperview];
  11. appDelegate.loadingView = nil;
  12. }
  13. }

Hint

you should set images array to loadingView to animate them.

  1. [appDelegate.loadingView setImagesArray:@[@"L.png", @"L2.png",@"L3.png", @"L4.png",@"L5.png", @"L6.png", @"L7.png"]];

Contact

Hassan Refaat

License

The MIT License (MIT)

Copyright (c) 2017 Hassan Refaat

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.