Comments (6)
I'm having the same issue ... did you find a fix @Harryjeffs ?
I tried
self.view.bringSubviewToFront(button2Image)
where button2Image is the image that the BadgeHub is attached to. Same behaviour as you reported.
from badgehub.
@lcolli98 Hey! I posted to stackoverflow, and found the answer myself - https://stackoverflow.com/questions/61298622/uicollectionviewcell-badge-masked-behind-view.
Issue was how I was rounding the corners. Let me know if this helps you too :)
from badgehub.
That isn't working for me ... any ideas?
button2Image is a UIImageView on top of a UIButton, button2. The badge is being appended to the image view. I've tried manually changing the Z position, ensuring it is first in the storyboard, and bringSubviewToFront, but still no luck.
The image view doesn't have rounded corners (the button does, but the badge should easily be contained within the button).
from badgehub.
@lcolli98 Mind sharing some code so we can help debug?
from badgehub.
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var button1: UIButton!
@IBOutlet weak var button2: UIButton!
@IBOutlet weak var button2Image: UIImageView!
@IBOutlet weak var button3: UIButton!
@IBOutlet weak var button4: UIButton!
@IBOutlet weak var userAccButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// Set the title text based on whether logged in or not
/*
if (loggedIn) {
titleLabel.text = "Welcome back, <name>"
} else {
titleLabel.text = "Welcome to AeroBuddy"
}
*/
// Setup user account button
userAccButton.layer.cornerRadius = 0.5 * userAccButton.bounds.size.width
userAccButton.clipsToBounds = true
userAccButton.layer.borderWidth = 2
userAccButton.layer.borderColor = UIColor.lightGray.withAlphaComponent(0.6).cgColor
// Set the news notifcation bubble - see https://iosexample.com/a-way-to-quickly-add-a-notification-badge-icon-to-any-view/
// Use newsBubble.increment(), newsBubble.decerement(), newsBubble.setCount(newCount: Int) to control
self.view.bringSubviewToFront(button2Image)
let newsBubble = BadgeHub(view: button2Image)
if (false /* no unread news */) {
newsBubble.setCount(0)
} else {
// Set the amount of unread news articles
newsBubble.setCount(1)
//self.view.bringSubviewToFront(button2Image)
newsBubble.bump()
}
}
That's the view controller where everything is displayed.
from badgehub.
For anyone else with this issue ... I added a transparent UIView over the top of the button and added the BadgeHub to that. This works.
from badgehub.
Related Issues (17)
- Unable to find a specification for `BedgeNotificHub` HOT 2
- Does it really works on storyboards
- dose not support red dot style? HOT 1
- SetCount to 0 and checkZero not removing red dot HOT 1
- Question: How to create a badge for each segment of the control HOT 1
- The badge view was clipped by navigation bar HOT 1
- Add support for UIBarButtonItem convenience initializer HOT 1
- init?(barButtonItem: UIBarButtonItem) create nil BadgeHub HOT 2
- Can we add badge for searhbar scope buttons
- BarButton Item Badge Cut Off HOT 1
- UITableViewCell HOT 2
- Hide Count hiding wrong object? HOT 1
- maxCount is not taken into account when calling the increment method HOT 1
- [FEATURE] Expend the size of badge to fit larger digits HOT 1
- [MIGRATION] Migrate to Swift 5
- Initializer is not specifically marked public
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from badgehub.