mustafaibrahim989 / mibadgebutton-swift Goto Github PK
View Code? Open in Web Editor NEWiOS custom badge button.
License: MIT License
iOS custom badge button.
License: MIT License
Thank you for this great work. I would like to tell you I'm getting this warning message from the terminal when I install MIBadgeButton via CocoaPods. @mustafaibrahim989
[!] Unable to read the license file /Users/username/appname.iOS/Pods/MIBadgeButton-Swift/mit-license.txt for the spec MIBadgeButton-Swift (0.1)
`
I am setting my button image to a gradient image and masking the actual button image over it, but have found that when using this process it is not showing the badge button indicator anymore. As soon as I change it back to as non masked style button it works just fine. Is there a way to use a masked button and not loose the indicator?? I can obviously use a UIView for this if necessary, but wanted to ask if you may have a solution before I went that route????
Also, completely unrelated to the first issue, just FYI the way you have your POD setup, it forces cocoa pods to download the full version of this with every single update. Not sure if this is intended, but seems to be completely unnecessary as if there is an update it will download it automagically. Keep up the great work!!! Thank you!!!
my terminal showed that
[!] Unable to find a specification for `MIBadgeButton-Swift`
throwing my this error when I try to add a button to storyboard and give it the MiBadgeButton class and add an IBOutlet to it in code:
"Use of undeclared type MiBadgeButton"
i have tried:
import MIBadgeButton_Swift
but it does not seem to help.
Any Ideas?
Any version compatible with Swift 4.2?
How to add badge on top of system BarButtonItem of specific style (ex. bookmarked)
i am able to set my own image by button.setImage(UIImage(named: "filter_icon"), forState: .Normal)
. But how can we use system UIBarButtonSystemItem
images?
Any help!
Can you set the size of the badge?
Nice pod but we can't use it as a dependency since your pod is pointing to 0.4
This is like the #14 issue but we can't do :
s.dependency "MIBadgeButton-Swift", :git => "https://github.com/mustafaibrahim989/MIBadgeButton-Swift.git", :branch => "master"
Since podspec doesn't manage git / branch, only versions are managed here.
As I said `s.dependency "MIBadgeButton-Swift"' is pointing to 0.4
if i'm hope show Badge text on Button's center?
What should I do?
Hi Mustafa,
I am facing issue on this line, in code that you have shared:
labelString.drawInRect(textFrame, withAttributes: attributes as [NSObject: AnyObject]) // issue is here
Message: [NSObject: AnyObject] cannot be converted to expected type [String : AnyObject]?
Pankaj Bansal
how can add border in circle badge ?
thankyou
Can you be sure to resubmit your podspec to Cocoapods?
Using the below code to display a UIBarButtonItem with a Font Awesome icon. The Badge displays behind the shopping cart.
Any help would be appreciated.
let button = MIBadgeButton(type: .Custom)
button.badgeString = String(qty)
button.frame = CGRectMake(0, 0, 55, 40)
button.badgeEdgeInsets = UIEdgeInsetsMake(15, 0, 0, 10)
button.titleLabel?.font = UIFont.fontAwesomeOfSize(30)
button.setTitle(String.fontAwesomeIconWithName(FontAwesome.ShoppingCart), forState: .Normal)
button.setTitleColor(UIColor.whiteColor(), forState: .Normal)
button.badgeBackgroundColor = UIColor(red: 147/255, green: 149/255, blue: 151/255, alpha: 1.0)
button.setTitleColor(UIColor(red: 147/255, green: 149/255, blue: 151/255, alpha: 0.6), forState: .Highlighted)
button.addTarget(self, action: #selector(DryCleaning.backToServices), forControlEvents: UIControlEvents.TouchUpInside)
let barButton = UIBarButtonItem(customView: button)
self.navigationItem.rightBarButtonItem = barButton
Can you expose badgeLabel - perhaps as a read only property, so we can make changes to the frame and other properties of the UILabel?
Hi,
I installed the library through CocoaPods. Added a UIButton
(just an image, no text) and set its class to MIBadgeButton
. I didn't do any modifications through the IB.
Then I tried to increase the badge count every time the button is pressed. But when setting the badge string, the app crashes with a EXC_BAD_ACCESS error.
Below is my code.
import UIKit
import MIBadgeButton_Swift
class ViewController: UIViewController {
@IBOutlet weak var button: MIBadgeButton!
var count = 0
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func didTapButton(_ sender: MIBadgeButton) {
count = count + 1
sender.badgeString = "\(count)"
}
}
I also uploaded a demo project here.
In iOS 10, it looks OK but in iOS 11, the statusbar overlap badge label when push navigation. Can anyone help me? Thanks
Please see my image: https://i.stack.imgur.com/aCKFy.png
Am getting a lot of errors with xcode 8 beta 6
add repo to cocoa pod
can you please make it compatible with carthage?
Hi my issue is probably the same as the one described in the Objective-C repo (mustafaibrahim989/MIBadgeButton#3).
When using a button's border, the border is displayed above the badge.
For instance:
button.layer.cornerRadius = 5
button.layer.borderColor = UIColor.white.cgColor
button.layer.borderWidth = 1
button.badgeBackgroundColor = UIColor.blue
It would be fantastic to have an easy way to use this on a UIBarButtonItem. Any chance you will extend it to cover this? I want to use this for a notification count indicator badge.
The ability to change the badgeLabel font - could be done by exposing a property like other you did...I have it changed in my source
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.