Giter Club home page Giter Club logo

mbcircularprogressbar's Introduction

Version License Platform Carthage compatible Analytics

If you use MBCircularProgressBar, please tell me and I will add your app here.

Usage

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

Installation

Cocoapods

MBCircularProgressBar is available through CocoaPods.

To install it, simply add the following lines to your Podfile:

  • Add this line to the begining of your Podfile in order to support @IBDesignable. More info here (Thanks to: @StevenMasini)
use_frameworks!
  • Add this line so with every Pod install/update cocoapods would download the library intro your project:
pod "MBCircularProgressBar"

Installation with Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate MBCircularProgressBar into your Xcode project using Carthage, specify it in your Cartfile:

github "MatiBot/MBCircularProgressBar"

Run carthage update to build the framework and drag the built MBCircularProgressBar.framework into your Xcode project.

Directly

You can also download the MBCircularProgressBar{View,Layer}.{m,h} files into your project directly

Properties

Property name Property type Description Range
value CGFloat The value to be displayed in the center [0,maxValue]
maxValue CGFloat The maximum possible value, used to calculate the progress (value/maxValue) [0,∞)
showValueString BOOL Should show value string
showUnitString BOOL Should show unit string
valueFontName NSString The name of the font of the value string Any valid font name
valueFontSize CGFloat The font size of the value text [0,∞)
valueFontName NSString The name of the font of the unit string Any valid font name
unitFontSize CGFloat The font size of the unit text [0,∞)
unitString NSString The string that represents the units, usually %
fontColor UIColor The color of the value and unit text
decimalPlaces NSInteger Number of decimal places of the value [0,∞)
progressRotationAngle CGFloat Progress bar rotation (Clockewise) [0,100]
progressAngle CGFloat Set a partial angle for the progress bar [0,100]
progressLineWidth CGFloat The width of the progress bar (user space units) [0,∞)
progressColor UIColor The color of the progress bar
progressStrokeColor UIColor The color of the progress bar frame
progressCapType NSInteger The shape of the progress bar cap {kCGLineCapButt=0, kCGLineCapRound=1, kCGLineCapSquare=2}
emptyLineWidth CGFloat The width of the background bar (user space units) [0,∞)
emptyLineColor UIColor The color of the background bar
emptyCapType CGFloat The shape of the background bar cap {kCGLineCapButt=0, kCGLineCapRound=1, kCGLineCapSquare=2}
textOffset CGPoint The offset to apply to the unit / value text (0,0) = center of the circle

Animation

In order to animate a change in the progress bar you should nest the value property manipulation in a [UIView animateWithDuration:] method

    [UIView animateWithDuration:1.f animations:^{
        self.progressBar.value = 55.f;
    }];

References

[iOS][Swift] MBCircularProgressBar で円形のプログレスバーを実現 by @cocominap (in Japanese)

Author

Mati Bot, [email protected], @b0tnik

Apps that use it:

20 Hours

License

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

mbcircularprogressbar's People

Contributors

djdiaz avatar jwardle avatar matibot avatar reneb avatar softeqdg avatar thorntonbm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mbcircularprogressbar's Issues

Q: How to display float value?

Hi all,
from the question, I can only display the int value,
in my case I need float, so, Is there a way to solve my problem?
thx!

MBCircularProgressBar in Swift

Failed to render and update auto layout status for ViewController (3ER-ba-6G7): dlopen(MBCircularProgressBar.framework, 1): no suitable image found. Did find: MBCircularProgressBar.framework: required code signature missing for 'MBCircularProgressBar.framework'. When Add the MBCircularProgressBar Class to view this Error Show.Please help me. Thanks

Add animation completion block

I need to know when the animation is complete. It would be wonderful if you could add another method that supports completion: setValue:animated:completion. I'm looking into it but it seems more difficult with implicit animation.

Unit String at the right side of value lable

Thanks for this awesome Control.
How can we put unit string at the left side to use the animation feature of value change, in my case I need to show

$0 to $100

so $ is the unit and it must be at the left side of the value.

Please suggest.

Unable to update font

Hi,

In my app, I have functionality to update font, but _dataComsumedView (object of MBCircularProgressBar) does not update font.
`- (void)updateFont {
// Create and share access to an NSUserDefaults object
NSUserDefaults *mySharedDefaults = [[NSUserDefaults alloc] initWithSuiteName:GROUP_NAME];
if (![mySharedDefaults objectForKey:DEFAULT_FONT_NAME]) {
[mySharedDefaults setObject:@"AvenirNext-Medium" forKey:DEFAULT_FONT_NAME];
[mySharedDefaults synchronize];
}
NSString *fontName = [mySharedDefaults objectForKey:DEFAULT_FONT_NAME];

BOOL needToUpdateFont = NO;

if (!_currentFont || (_currentFont && ![_currentFont isEqualToString:fontName])) {
    _currentFont = fontName;
    needToUpdateFont = YES;
}

if (needToUpdateFont) {
    [_dataComsumedView setValueFontName:fontName];
    [_dataComsumedView setUnitFontName:fontName];
}

}`

IB Designables Warnings

Hi Mati,

First I would like to tell you that your framework is really awesome!

But I'm meeting some warning every time I update a value in Interface Builder.
All the properties are rising an exception of this kind.

warning: IB Designables: Ignoring user defined runtime attribute for key path "maxValue" on instance of "UIView". Hit an exception when attempting to set its value: [<UIView 0x7fc911624cd0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key maxValue.

Is there is a way we can disable IBDesignable, or do you have a solution to fix this issue ?

Steven.

@IBDesignable

I add use_frameworks! in my podfile using interface builder but other libraries are affected them.
It show an error which is header files don't find.

Error: IB Designables No Suitable Image Found

I installed MBCircularProgressBar using Carthage. I'm facing the error below when using MBCircularProgressBar in Interface Builder.

error: IB Designables: Failed to render and update auto layout status for ViewController (BYZ-38-t0r): dlopen(MBCircularProgressBar.framework, 1): no suitable image found.  Did find:
MBCircularProgressBar.framework: required code signature missing for 'MBCircularProgressBar.framework'

I tried removing ~/Library/Developer/Xcode/DerivedData/ then cleaning and rebuilding project. However, the issue persists.

Using Xcode 9.3.1 and Swift 4

Proper way to "pause" progress bar?

I have integrated this progress bar in my app alongside a timer however one area that is really getting me stuck is properly "pausing" this progress bar. For example, if the bar is 48% filled to its max value, how can I stop it at one instance and then later on resume it where it begins from 48%?

I mostly am trying to do this so I can have a pause/resume feature with the timer however my home-cooked approach is very finicky and not very conducive.

Receive serious memory warning!

if the ture value is farstly bigger than the max value ,the demo will continue draw the progress line ,which will lead to the serious memeory warning of iPhone simulator

ProgressBar only appears when the tableview cell is selected

I added MBCircularProgressBar to my tableview cell and set its value in cellForRowAtIndexPath using myCell.progressBar.value = 25 I want the progressBar to appear in all tableview cells (when selected or not) but it's only appearing in the tableview cell that's selected, not the rest of the cells. Any ideas?

Animation inside UITableView

Seems animation doesn't work if I place the instance of progress bar in custom cell and call setValue with animationWithDuration

Edit: it works when scrolling but not sure how to make it visible in first load. Anyhow, I think this can be closed as it is not this code issue. Thank you!

Not able to submit my app to store because of CFBundleExecutable Key error.

Here is the error:

ERROR ITMS-90535: "Unexpected CFBundleExecutable Key. The bundle at 'Payload/Telematics.app/Frameworks/MBCircularProgressBar.framework/MBCircularProgressBar.bundle' does not contain a bundle executable. If this bundle intentionally does not contain an executable, consider removing the CFBundleExecutable key from its Info.plist and using a CFBundlePackageType of BNDL. If this bundle is part of a third-party framework, consider contacting the developer of the framework for an update to address this issue."
ERROR ITMS-90535: "Unexpected CFBundleExecutable Key. The bundle at 'Payload/Telematics.app/Frameworks/MBCircularProgressBar.framework/MBCircularProgressBar.bundle' does not contain a bundle executable. If this bundle intentionally does not contain an executable, consider removing the CFBundleExecutable key from its Info.plist and using a CFBundlePackageType of BNDL. If this bundle is part of a third-party framework, consider contacting the developer of the framework for an update to address this issue."

Swift 4 support

Hi, are there plans to update to Swift 4 in the near future? Thank you.

Ring Borders

Would it be possible to have a border drawn similar to the attached image?

image

NSTextAlignmentCenter not working

Hi,

I forked your project because I wanted the unit to be in a new line. The problem is that I aligned it with NSTextAlignmentCenter but it's not working. The alignment is always left. Is there any workaround?

Xcode 9 ibdesignable issue

I can not use interface builder with component. it cause crash on it.

error: IB Designables: Failed to render and update auto layout status for ... (iN0-l3-epB): dlopen(MBCircularProgressBar.framework, 1): no suitable image found. Did find:
MBCircularProgressBar.framework: required code signature missing for 'MBCircularProgressBar.framework'

Progresscolor Gradient

Hi, Thanks for this awesome Control.

How to set a progressColor gradient color?

Best Regards.

Update layout bug

When I try to change color without changing a value, it doesn't update the displayed bar color. I use it in uitableview.
It is annoying but fortunately, I can force-update just changing value every time.

Clear color background appearing black

When i attempt to set the background view color to clearColor the background of the progress bar appears black-- because I am setting this up over a static image I cannot use the workaround of setting the background color to the same background as the parent view. Please advise on possible work arounds or if I am using the class incorrectly.

Failed to load designable from path(null)

I am getting this error while assigning MBCircularProgressBarView class to UIView.

Failed to render the instance of MBCircularProgressBarView. Failed to load designable from path(null)

Crash on Xcode 6.4

Hi, I'm using your lib to make a progress bar for my app, and unfortunately, my Xcode has been crashed when trying to switch to another tab or other files.

screen shot 2015-08-18 at 11 34 19 am
Crash appears when click on another tab

Pod doesn't include setValue:animateWithDuration:

I installed with Cocoapods, but the setValue:animateWithDuration: method is not included in the files. I downloaded the source and installed it manually however. Not an expert on Cocoapods, but maybe the podspec needs to be updated?

Indeterminate Animation

Is there a way to make the progress indicator spin around if you can not determine a value for the progress? For example, downloading a file that you don’t know the length of.

Carthage update fail

*** Building scheme "MBCircularProgressBar" in MBCircularProgressBar.xcworkspace
Build Failed
	Task failed with exit code 65:
	/usr/bin/xcrun xcodebuild -workspace /Users/rJaspur/Code/Swift/Test/MijnBewijsstukken/MijnBewijsstukken/Carthage/Checkouts/MBCircularProgressBar/Example/MBCircularProgressBar.xcworkspace -scheme MBCircularProgressBar -configuration Release -derivedDataPath /Users/rJaspur/Library/Caches/org.carthage.CarthageKit/DerivedData/MBCircularProgressBar/0.3.4 -sdk iphonesimulator -destination platform=iOS\ Simulator,id=71393AA9-848E-42BB-A478-ECEBAC1296F4 -destination-timeout 3 ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/kq/92sqq9ps5j78dxyf062tzchm0000gn/T/carthage-xcodebuild.EsGQem.log

Compilation error when integrating via Carthage using option --no-use-binaries

When integrating the lib using Carthage and building dependencies from sources (using flag --no-use-binaries) the compilation fails due to invalid bundle with assets.

The root cause of this issue is that shared scheme with dynamic framework (that Carthage is using) is in fact a auto-generated Cocoapod scheme. So without running pod install the compilation will always fail.

To fix this we should create a standalone dynamic framework scheme, as opposed to re-using autogenerated scheme from Cocoapods.

no suitable image found in swift

error: IB Designables: Failed to render and update auto layout status for wheatherViewController (3ER-ba-6G7): dlopen(MBCircularProgressBar.framework, 1): no suitable image found. Did find:
MBCircularProgressBar.framework: required code signature missing for 'MBCircularProgressBar.framework'

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.