UIBarButtonItem-Badge icon indicating copy to clipboard operation
UIBarButtonItem-Badge copied to clipboard

iOS 9 makes the badge a square?

Open jsoncylu opened this issue 9 years ago • 11 comments

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?

jsoncylu avatar Sep 21 '15 04:09 jsoncylu

+1

guidev avatar Sep 21 '15 14:09 guidev

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);

iBlacksus avatar Sep 24 '15 15:09 iBlacksus

I've fixed this bug. https://github.com/mikeMTOL/UIBarButtonItem-Badge/pull/15

Bandd-k avatar Sep 29 '15 16:09 Bandd-k

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);

liyanxiang avatar Sep 30 '15 02:09 liyanxiang

It worked. Thanks :+1:

pavan168 avatar Nov 29 '15 07:11 pavan168

+1

radekwilczak avatar Dec 14 '15 12:12 radekwilczak

+1

zeeshanhaider-devbatch avatar Dec 22 '15 05:12 zeeshanhaider-devbatch

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

tc-diamond avatar Jan 11 '16 13:01 tc-diamond

+1

Souf-R avatar Jan 22 '16 17:01 Souf-R

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.

rhigueraa avatar Jan 26 '16 21:01 rhigueraa

+1

atulvuliv avatar May 04 '16 06:05 atulvuliv