Giter VIP home page Giter VIP logo

uicountinglabel's Issues

add animation effect

I was hoping for an odometer effect like this
http://github.hubspot.com/odometer/api/themes/

it seems like using kCATransitionFromBottom this should be possible.

  // Add transition (must be called after myLabel has been displayed)
    CATransition *animation = [CATransition animation];
    animation.duration = .3;
    animation.type = kCATransitionFromBottom;
    animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    [_instructions.layer addAnimation:animation forKey:@"changeTextTransition"];

    // Change the text
    _instructions.text = @"127";

need a 'stop' method

你好能不能暴露一个 stop 的方法,计数到一半想要停止,然后立刻改成其他的值

Unable to update pod version to 1.4.1

The pod file does not find the newest version of it

[!] Unable to satisfy the following requirements:

- `UICountingLabel (~> 1.4.1)` required by `Podfile`

None of your spec sources contain a spec satisfying the dependency: `UICountingLabel (~> 1.4.1)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

Add support for larger numbers

First of all, great library :)

The only thing I'd ask for is support for numbers (ie. NSDecimalNumber) with a higher value than the float max.

Has anyone been able to get this to work with the @"%d" format, or showing a float with no decimal values?

All I want to do is count from a value like 0 to 38. I don't want to display any decimal points or numbers after a decimal point. Just want a simple number like "38" or "500".

Is anyone successfully doing this? If I set my format to @"%d", the label counts up weird and stops at the wrong value. I have tried hacking around in the repo and using formatted strings but nothing seems to work.

Is anyone successfully doing this, or does anyone know how it can be done?

Thanks for the help!

Cocoapods

I second that emotion. Going to give you credit in our app definitely.

Leading zeros

Would be nice to be able to specify a fixed number of characters so it would automatically pad with leading zeros.

provide method to initialize counter

Hi

This is a very useful pod. I wasn't able to figure out how to initialize the counter to something other than 0. Right now my viewDidLoad has
[self.myLabel countFrom:123 to:123 withDuration:0.0f ];
as an example to initialize to 123.

The currentValue property doesn't have associated get/set options.
(I could also be making a silly mistake, I'm somewhat new to iOS and objective C)

License

Hi, I really appreciate that you have this as open source, What is the License on this?

[self.barChart strokeChart]; creates EXE_BAD_ACCESS

I just updated to this latest build and when I call the [self.barChart strokeChart]; it gives EXE_BAD_EXEC error in below line:

PNBarChart.m file

- (void)strokeChart
{
    [self viewCleanupForCollection:_labels];
    ......
    //Add y labels

        float yLabelSectionHeight = (self.frame.size.height - _chartMargin * 2 - xLabelHeight) / _yLabelSum;

        for (int index = 0; index < _yLabelSum; index++) {

            // This line causes the EXE_BAD_ACCESS
            NSString *labelText = _yLabelFormatter((float)_yValueMax * ( (_yLabelSum - index) / (float)_yLabelSum )); // CAUSES ERROR EXE_BAD_ACCESS

Any ideas?

formatBlock crashes with EXC_BAD_ACCESS on Swift

After importing UICountingLabel into a Swift project, setting format works as expected:

myLabel.format = "$%d asdf" // This works

I then attempt to set formatBlock:

totalDebtLabel.formatBlock = {(debtValue) -> String in
    let returnString = "$\(debtValue) asdf"
    return returnString
}

I expect this to work similarly, but instead I get an EXC_BAD_ACCESS crash:

* thread #1: tid = 0x123f44, 0x01f500be libobjc.A.dylib`objc_msgSend + 26, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x22281)
    frame #0: 0x01f500be libobjc.A.dylib`objc_msgSend + 26
    frame #1: 0x01f50eb1 libobjc.A.dylib`objc_release + 65
  * frame #2: 0x000edc05 ExampleApp`reabstraction thunk helper from @callee_owned (@unowned Swift.Float) -> (@owned Swift.ImplicitlyUnwrappedOptional<Swift.String>) to @callee_unowned @objc_block (@unowned Swift.Float) -> (@autoreleased Swift.ImplicitlyUnwrappedOptional<ObjectiveC.NSString>) + 229 at ViewController.swift:31
    frame #3: 0x00122dfc ExampleApp`-[UICountingLabel setTextValue:](self=0x7a099390, _cmd=0x00129f4e, value=20.8544655) + 348 at UICountingLabel.m:204
    frame #4: 0x00122bfd ExampleApp`-[UICountingLabel updateValue:](self=0x7a099390, _cmd=0x00129fe9, timer=0x79ece300) + 621 at UICountingLabel.m:190
    frame #5: 0x00957819 Foundation`__NSFireTimer + 97
    frame #6: 0x002990b6 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    frame #7: 0x00298a3d CoreFoundation`__CFRunLoopDoTimer + 1309
    frame #8: 0x00257e6a CoreFoundation`__CFRunLoopRun + 2090
    frame #9: 0x0025737b CoreFoundation`CFRunLoopRunSpecific + 443
    frame #10: 0x002571ab CoreFoundation`CFRunLoopRunInMode + 123
    frame #11: 0x04f382c1 GraphicsServices`GSEventRunModal + 192
    frame #12: 0x04f380fe GraphicsServices`GSEventRun + 104
    frame #13: 0x00d6c0c6 UIKit`UIApplicationMain + 1526
    frame #14: 0x000f02ee ExampleApp`top_level_code + 78 at AppDelegate.swift:12
    frame #15: 0x000f032b ExampleApp`main + 43 at AppDelegate.swift:0
    frame #16: 0x026aaac9 libdyld.dylib`start + 1

I attempted to debug the problem using image lookup --address and the Zombie profiler, but didn't find anything interesting.

Use comma instead of period?

Great extension!
Is it possible to get UICountingLabel to work with a comma instead of a period as a decimal point? Eg 1,3 instead of 1.3.
Have tried format = @"%,1f";

Remove string `format` property, replace with `setFormat:` method

Instead of having a separate NSString* format, only expose the formatBlock property, and make a setFormat: method that sets up the right format block only at set time instead of on every iteration.

This will ultimately improve performance, as a single block call each time is much faster than regular expression searches every frame.

So, it would look something like:

-(void)setFormat:(NSString*)format
{
    self.formatBlock = ^(NSString*) ^(float val) {
        return [NSString stringWithFormat:format,val];   
    };
}

Note - something will have to deal with formats that pass in %d or %i (as the current regex does) - perhaps find these and then cast to int if it has those? maybe two different blocks? just ideas

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.