ckteebe / custombadge Goto Github PK
View Code? Open in Web Editor NEWCustomBadge is an Objective-C based component to create customized Badges for any given View.
Home Page: http://saschapaulus.de/opensource
License: MIT License
CustomBadge is an Objective-C based component to create customized Badges for any given View.
Home Page: http://saschapaulus.de/opensource
License: MIT License
I have a UIView in XIB, I just set it's file owner to CustomBadge. I have the IBOutlet of this CustomBadge view. My issue is that I am not able to set the badge number on this view now.
initWithFrame:
and initWithCoder
methods are not implemented in the CusomBadge class which causes crash, because badgeStyle is nil in these cases
When the badge is draw a lot of error at diferents methods that say "invalid context 0x0" happend:
: CGContextSaveGState: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextSetAlpha: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextBeginTransparencyLayerWithRect: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextSaveGState: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextSetFillColorWithColor: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextMoveToPoint: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextAddArc: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextAddArc: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextAddArc: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextAddArc: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextClosePath: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextDrawPath: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextRestoreGState: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextSaveGState: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextSetStrokeColorWithColor: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextSetLineWidth: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextMoveToPoint: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextAddArc: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextAddArc: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextAddArc: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextAddArc: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextClosePath: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextDrawPath: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextRestoreGState: invalid context 0x0
Jan 14 13:44:26 ??[1765] : CGContextEndTransparencyLayer: invalid context 0x0
Some info at http://stackoverflow.com/questions/3571053/cgcontext-cgbitmapcontextcreateimage-errors-how-to-fix
Please add semantic version tags.
I’ve recently added CustomBadge to the CocoaPods package manager repo.
CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.
However, CustomBadge doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.
Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.
In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:
$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags
Thanks!
when two number ,why the rectangle is not the circle
i get this error when used with FXBlurView in iOS 7
Assertion failed: (CGFloatIsValid(x) && CGFloatIsValid(y)), function void CGPathAddArc(CGMutablePathRef, const CGAffineTransform *, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, bool), file Paths/CGPath.cc, line 279.
so i added the following condition in drawRoundedWithContext
if(rect.size.width > 0 && rect.size.height > 0) {
}
only then we allow the code to be executed else the app will crash
As described in title.
can you add a solid colored style, like iOS 7 does...
CoreGraphics
CG::Path::Subpath::add_arc(CGPoint const&, double, double, double, bool, CGAffineTransform const*)
CustomBadge.m line 136
-[CustomBadge drawRoundedRectWithContext:withRect:]
CustomBadge.m line 233
Crashed: com.apple.main-thread
SIGABRT ABORT at 0x0000000196c47270
Seems something wrong here, my env is iOS8
Could update version 3.0 at cocoapod?
Many Thanks.
This code uses selectors not present in iOS 3.x. For example,
self.contentScaleFactor = [[UIScreen mainScreen] scale];
both contentScaleFactor
and scale
properties are not present in iOS 3.x.
If you use it on iOS 3.x it will crash with unrecognized selector
I've got a timer which test for a value each second, and this value is passed to a badge with autoBadgeSizeWithString but value doesn't get updated.
badge_cart = [CustomBadge customBadgeWithString:[NSString stringWithFormat:@"%d",countValue] withStringColor:[UIColor whiteColor] withInsetColor:[UIColor redColor] withBadgeFrame:NO withBadgeFrameColor:[UIColor clearColor] withScale:0.8 withShining:NO withFrame:CGRectMake(15, -10, 10, 10)];
badge_cart.tag = 10;
[badge_cart.layer setShadowColor:[UIColor clearColor].CGColor];
[badge_cart setBackgroundColor:[UIColor clearColor]];
[Btn_Cart addSubview:badge_cart];
button added on cart there is a small shadow created by custom badge when look very closely to it
i want to remove the shadow which created by CustomBadge view.
For Information please find the below image.
I ensured that the view was not set to clip to bounds, however the shadow is getting clipped. In all of your screenshots and others also. What can be done to ensure that the shadow is able to be feathered out without the harsh line of where the frame ends?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.