Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 9 makes the badge a square? #14

Open
jsoncylu opened this issue Sep 21, 2015 · 11 comments
Open

iOS 9 makes the badge a square? #14

jsoncylu opened this issue Sep 21, 2015 · 11 comments

Comments

@jsoncylu
Copy link

UIBarButtonItem-Badge was working fine in iOS 8 but after upgrading to iOS 9 and Swift 2.0 the badge now shows up as a square. Anyone know a fix?

@guidev
Copy link

guidev commented Sep 21, 2015

+1

@iBlacksus
Copy link

I found the solution! I don't understand why, but in iOS 9 we need to update frame after layer...
In the end of function "updateBadgeFrame" use this code:

self.badge.layer.cornerRadius = (minHeight + padding) / 2;
self.badge.layer.masksToBounds = YES;
self.badge.frame = CGRectMake(self.badgeOriginX, self.badgeOriginY, minWidth + padding, minHeight + padding);

@Bandd-k
Copy link
Contributor

Bandd-k commented Sep 29, 2015

I've fixed this bug.
#15

@liyanxiang
Copy link

ok
this my code with fix ios9 bug (好啦!我修复这个bug啦,我是不是很牛逼?哈哈哈,其实顺序改一下,就行了)

self.badge.layer.masksToBounds = YES;
self.badge.layer.cornerRadius = (minHeight + padding) / 2;
self.badge.frame = CGRectMake(self.badgeOriginX, self.badgeOriginY, minWidth + padding, minHeight + padding);

@pavan168
Copy link

It worked. Thanks 👍

@radekwilczak
Copy link

+1

1 similar comment
@zeeshanhaider-devbatch
Copy link

+1

@tc-diamond
Copy link

add in badge's lazy getter. So it will be working on iOS 9.2. Without it doesn't work
lbl.clipsToBounds = YES;

@Souf-R
Copy link

Souf-R commented Jan 22, 2016

+1

@rhigueraa
Copy link

I'm running 9.2 and still see the label squared. Even after lbl.clipsToBounds = YES;
On launch it kinda changes from circular to squared, I can see that it has some strange visual effect.
Trying to solve it.

@atulvuliv
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests