rkrenecky / badgecontrol Goto Github PK
View Code? Open in Web Editor NEWBadge view with controller written in Swift 5.0
License: MIT License
Badge view with controller written in Swift 5.0
License: MIT License
Hi hello,
I am facing two kinds of issues,
when I added with button and imageview it works cool. i am trying to add with NavigationItem.BarButtonItems
it's not showing kindly do needful.
private var bageController: BadgeController!
lazy var naviCartButton: UIButton = {
$0.setImageForAllStates(UIImage(named: "icon_cart_color")!)
$0.imageEdgeInsets = .init(top: 5, left: 5, bottom: 5, right: 5)
$0.addTarget(self, action: #selector(self.openCart), for: .primaryActionTriggered)
return $0
}(UIButton())
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.rightBarButtonItem = UIBarButtonItem(customView: naviCartButton)
setupBadgeView()
// Do any additional setup after loading the view.
}
private func setupBadgeView() {
guard let customView = self.navigationItem.rightBarButtonItem?.customView as? UIButton else {
return
}
bageController = BadgeController(for: naviCartButton)
bageController.centerPosition = .upperRightCorner
bageController.badgeTextColor = .white
bageController.badgeBackgroundColor = ApplicationColor.bright
bageController.animateOnlyWhenBadgeIsNotYetPresent = true
bageController.badgeTextFont = Font(.installed(.OpenSansSemiBold), size: .standard(.h5)).instance
bageController.addOrReplaceCurrent(with: "1", animated: true)
}
When it goes to single digits to double digit (9 to 10 and 10 to 9), Badge roundview is breaking
Refer Below ScreenShots
Hello, when i try this instruction as i see on the readme :
self.badge!.addOrReplaceCurrent(with text: "5", animated: true)
produces an error -> "Expected ',' separator" :
And when i try to fix it so no error is showed with this line :
self.badge!.addOrReplaceCurrent(with : "5", animated: true)
I don't see any text on the badge
Hi, how can I add target function for the badge when I click on it?
And thanks for this awesome library.
Hello. This is a really nice control. Any chance the CocoaPod could be updated to 1.2.0?
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.