kciter / Floaty

:heart: Floating Action Button for iOS
MIT License
1.57k stars 310 forks source link

Adding a UIView to the button #265

Open choujar opened 5 years ago

choujar commented 5 years ago

Hi folks,

I'm trying to add a uiview (kinda like a counter) to the floating button, like this:

Screenshot 2019-06-24 19 43 48

But, instead I'm getting this:

WhatsApp Image 2019-06-24 at 7 42 25 PM

Even though, the Debug view hierarchy in xCode is showing me this:

Screenshot 2019-06-24 19 49 19

I'm using the following to add the UIView: Floaty.global.button.addSubview(floatingCounter!)

Anyone has any tips please?

ElSifi commented 5 years ago

@choujar

floatingCounter.layer.zPosition = CGFloat.greatestFiniteMagnitude

Should fix that problem

choujar commented 4 years ago

Hi @Badi3 - I actually fixed it by adding a separate UIView (with a UILabel inside) and dynamically placing it based on the position of the floating button. But I'll try your solution and get back to you!

Thanks!