Code Monkey home page Code Monkey logo

baloadingview's Introduction

BALoadingView

Version License Platform

Overview

example1 example2

A UIView that offers several loading animations.


Requirements

  • Works on any iOS device

Example

To run the example project, clone the repo, and run pod install from the Example directory first.


Getting Started

Installation

BALoadingView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "BALoadingView"

Simple Usage

startAnimation:

To add a BALoadingView to your app, add the line:

BALoadingView *view = [[BALoadingView alloc] initWithFrame:self.view.frame];
[self.loadingView initialize];
[self.loadingView startAnimation:BACircleAnimationFullCircle];
//OR [self.loadingView startAnimation:BACircleAnimationSemiCircle];

This creates the following animation/button by default:

example3a

Passing the BACircleAnimationSemiCircle enum produces:

example3b

stopAnimation

stopAnimation removes the animations from the view.

Advanced Usage

Listed below are examples of several properties that you can control.

Initialize

initialize sets the default values and should be called before setting any properties.

Duration

If you want the loading animation to last longer/shorter, you can edit the duration property:

BALoadingView *loadingView = [[BALoadingView alloc] initWithFrame:self.view.frame];
[self.loadingView initialize];
self.loadingView.duration = 20.0f;
self.loadingView.segmentColor = [UIColor whiteColor];
[self.loadingView startAnimation:BACircleAnimationFullCircle];

This creates this view:

example4

Clockwise

Editting the clockwise boolean property changes the direction of the full circle animation:

BALoadingView *loadingView = [[BALoadingView alloc] initWithFrame:self.view.frame];
[self.loadingView initialize];
self.loadingView.clockwise = YES;
self.loadingView.segmentColor = [UIColor whiteColor];
[self.loadingView startAnimation:BACircleAnimationFullCircle];

This creates this view:

example5

Segment Color

the segmentColorproperty controls the color of the segments and can be used like like in the example above

Line Cap

the lineCapproperty controls the end caps for the semi circle animation. The rouded cap option is seen below:

[self.loadingView initialize];
self.loadingView.lineCap = kCALineCapRound;
self.loadingView.clockwise = true;
self.loadingView.segmentColor = [UIColor whiteColor];
[self.loadingView startAnimation:BACircleAnimationFullCircle];

The animation looks like this:

example6

Author

Bryan Antigua, [email protected] - bryanantigua.com

License

BALoadingView is available under the MIT license. See the LICENSE file for more info.

baloadingview's People

Contributors

antiguab avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.