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

带数字的小红点不圆,被切割了 #45

Open
AlleniCode opened this issue Aug 28, 2017 · 10 comments
Open

带数字的小红点不圆,被切割了 #45

AlleniCode opened this issue Aug 28, 2017 · 10 comments

Comments

@AlleniCode
Copy link

badgeFont = [UIFont systemFontOfSize:12]; 这样的圆点好像被切割了一点,变得不圆了

@weng1250
Copy link
Owner

weng1250 commented Aug 28, 2017 via email

@luyud
Copy link

luyud commented Aug 28, 2017

模拟器分辨率不够导致的渲染问题吧, 和代码没关系, CMD + 1 看看园不圆

@AlleniCode
Copy link
Author

真机调试的,改成这样badgeFont = [UIFont systemFontOfSize:11];就没有问题,应该不是渲染问题吧

@luyud
Copy link

luyud commented Aug 30, 2017

@AlleniCode 我这样设置没问题,字体大小无关

[self.rightBarItem setBadgeFont:[UIFont systemFontOfSize:6]]

@AlleniCode
Copy link
Author

@LuYu001 你把字体设置的大一点试试呢?12+的字号试一下

@luyud
Copy link

luyud commented Aug 30, 2017 via email

@AlleniCode
Copy link
Author

@LuYu001 @weng1250
12 2x
13 2x
14 2x
15 2x

1、第一张:
badgeFrame = CGRectMake(0, 0, 18, 18);
badgeCenterOffset = CGPointMake(3, -3);
badgeFont = [UIFont systemFontOfSize:12];

2、第二张:
badgeFrame = CGRectMake(0, 0, 18, 18);
badgeCenterOffset = CGPointMake(3, -3);
badgeFont = [UIFont systemFontOfSize:13];

3、第三张:
badgeFrame = CGRectMake(0, 0, 18, 18);
badgeCenterOffset = CGPointMake(3, -3);
badgeFont = [UIFont systemFontOfSize:14];

4、第四张:
badgeFrame = CGRectMake(0, 0, 18, 18);
badgeCenterOffset = CGPointMake(3, -3);
badgeFont = [UIFont systemFontOfSize:15];

发现12号字和14号字有切边不圆,而13号字和15号字正常。

@luyud
Copy link

luyud commented Aug 31, 2017

@AlleniCode 看上去就是渲染问题啊,换个分辨率高些的设备看看吧, 我这么写没有发现, 作者削圆的方法也很简单,就是 layer.cornerRadius = view.height,1位数的情况下不可能不圆的。

[_header.btn1 setBadgeFont:[UIFont systemFontOfSize:14]];
 [_header.btn1  showBadgeWithStyle:WBadgeStyleNumber value:3 animationType:WBadgeAnimTypeNone];

btw, 并不建议手动设置 frame, 并且没有任何意义,还可能导致别的问题

@property (nonatomic, assign) CGRect badgeFrame;                    /* we have optimized the badge frame and center.
                                                                        This property is adviced not to set manually */

@AlleniCode
Copy link
Author

@LuYu001 我去掉badgeFrame的设置,也是一样的,不知道哪里出了问题。。。

@blmyself
Copy link

@AlleniCode 请问你解决这个问题了么,我也遇到了

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

4 participants