Code Monkey home page Code Monkey logo

flagprogressbar's Introduction

FlagProgressBar

a progress bar(index, volume) with above image flag, and bottom title flag if you need

Alt Text

#explain: ####the key of dictionary: #define KEY_FLAGIMAGE @"KEY_FLAGIMAGE" //UIImage #define KEY_TITLE @"KEY_TITLE" //NSString #define KEY_INDEX @"KEY_INDEX" //NSString #define KEY_OFFSET_X @"KEY_OFFSET_X" //NSString #define KEY_OFFSET_Y @"KEY_OFFSET_Y" //NSString #define KEY_TITLE_COLOR @"KEY_TITLE_COLOR" //UIColor #define KEY_ATTRIBUTED_STRING @"KEY_ATTRIBUTED_STRING"//NSAttributedString

####PARA: index:The total number of the progress bar

volum: The total number of the progress bar

holderBarColor:bar backgroundcolor

contentBarColor:bar contentcolor

imageTitleOffSet:offset with the title in flagImage which above the progressBar(CGPoint)

imageTitleColor:color with the title in flagImage which above the progressBar

flagImageDictionaryList:a NSArray with flagImage dictionaries(contains:KEY_FLAGIMAGE, KEY_TITLE,KEY_INDEX,KEY_OFFSET_X,KEY_OFFSET_Y) example:

NSMutableDictionary *dict_one = [NSMutableDictionary dictionary];
[dict_one setValue:[UIImage imageNamed:@"dialogButton_center_gray"] forKey:KEY_FLAGIMAGE];
[dict_one setValue:@"及格" forKey:KEY_TITLE];
[dict_one setValue:holderBarColor forKey:KEY_TITLE_COLOR];
[dict_one setValue:@"3" forKey:KEY_INDEX];
[dict_one setValue:@"0" forKey:KEY_OFFSET_X];
[dict_one setValue:@"-5" forKey:KEY_OFFSET_Y];

NSMutableDictionary *dict_two = [NSMutableDictionary dictionary];
UIImage *image = [UIImage imageNamed:@"dialogButton_right_gray"];
[dict_two setValue:image forKey:KEY_FLAGIMAGE];
[dict_two setValue:@"满分" forKey:KEY_TITLE];
[dict_two setValue:holderBarColor forKey:KEY_TITLE_COLOR];
[dict_two setValue:@"7" forKey:KEY_INDEX];
[dict_two setValue:[NSString stringWithFormat:@"%0.f", -image.size.width/2 + 2] forKey:KEY_OFFSET_X];
[dict_two setValue:@"-5" forKey:KEY_OFFSET_Y];

NSArray *flagImageList = [NSArray arrayWithObjects:dict_one, dict_two, nil];

bottomFlagTitleDictionary:a NSDictionary with bottomFlagTitle which bottom the progressBar. example:

NSDictionary *bottomFlagTitleDict = [NSDictionary dictionaryWithObjectsAndKeys:attributeStr, KEY_ATTRIBUTED_STRING, @"0", KEY_OFFSET_X, @"2", KEY_OFFSET_Y, nil];

#usage: The simplest method of use, add in or storyBoard xib ZYProgressBar, associated to. M file, so you will have a ZYProgressBar object, you can start the game happily!!

If you want it to be animated, use ZYProgressBarV2

then, begin configure with the update method like this:

- (void)updateBarWithIndex:(int)index
                     volum:(int)volum
            holderBarColor:(UIColor *)holderBarColor
           contentBarColor:(UIColor *)contentBarColor
          imageTitleOffSet:(CGPoint)imageTitleOffSet
           imageTitleColor:(UIColor *)imageTitleColor
   flagImageDictionaryList:(NSArray *)flagImageDictionaryList
 bottomFlagTitleDictionary:(NSDictionary *)bottomFlagTitleDictionary;

that all !
Your progressBar will work according to your rules。

If you intend to use ZYProgressBar in the code without xib, you have to create an initializer,and implement "configureDefault" method in ZYProgressBar.m

###thanks !

flagprogressbar's People

Contributors

liuzhiyi1992 avatar

Stargazers

MohsinAli avatar MasterTan avatar  avatar Pranav Lathigara avatar  avatar

Watchers

James Cloos avatar MohsinAli avatar  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.