【发布时间】:2012-03-29 07:30:50
【问题描述】:
我想知道如何为 UIButton 设置一个徽章,比如 UITabBarController Badge?
【问题讨论】:
-
在 SO [1] 上查看 [this question][1] 的答案:stackoverflow.com/questions/4722669/…
标签: iphone cocoa-touch ipad uibutton badge
我想知道如何为 UIButton 设置一个徽章,比如 UITabBarController Badge?
【问题讨论】:
标签: iphone cocoa-touch ipad uibutton badge
您可以使用MKNumberBadgeView。
【讨论】:
您只想为按钮添加背景图片
UIImage *image = [UIImage imageNamed:@"YourBadge.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(200.0, 10.0, 20.0, 20.0); // or whatever dimensions you want
[button setBackgroundImage:image forState:UIControlStateNormal];
【讨论】: