Git Product home page Git Product logo

albatteryview's Introduction

#What is This class allow you to show a battery image and fill it with the current real charge. The color of the fill view depends by the battery level.

alt text

#Usage The usage is simple. First, drag the ALBatteryView folder to your project. The folder contains ALBatteryView.h, ALBatteryView.m, Resource folder with the battery image and the UIView+ALQuickFrame category (http://github.com/andrealufino/ALQuickFrame).

ALBatteryView *batteryView = [[ALBatteryView alloc] initWithFrame:CGRectMake(20, 40, 80, 80)];
[self.view addSubview:batteryView];
[batteryView setBatteryLevelWithAnimation:YES forValue:[UIDevice currentDevice].batteryLevelInPercentage inPercent:YES];

This will create a view of type ALBatteryView with the frame you want, will add it to the current view and will call the method to set the battery level. The batteryLevelInPercentage method is available thanks to a category of UIDevice declared in the header of ALBatteryView. This will animate the view filling the battery

#Limitation The battery view can be maximum 128x128 (width, height), this is because the png is 256x256 pixels. The battery view has to be a square, so the width and the height have to be the same.

#License Licesed under the MIT License.

albatteryview's People

Contributors

andrealufino 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.