开发者

Badge icon resource/view

Is there a built in badge icon like the info icon so that I can show status updates 开发者_开发问答on other views in my app? It's easy enough to duplicate manually but I'd like to use a built in resource if it's available.


Check out CustomBadge, the site is in German, but theres sample source code there.

You can also steal a badge from a tabbar view like this:

.h

IBOutlet UITabBarItem *tabbarItem;
UIView *badgeView;

.m

badgeView = [[UIView alloc] initWithFrame:CGRectMake(25,100, 32, 32)];
badgeView.backgroundColor = [UIColor clearColor];
badgeView.clipsToBounds = NO;
[badgeView addSubview:[((UIView *)[tabbar.subviews objectAtIndex:0]).subviews objectAtIndex:0]];

and to set the value for that badge:

tabbarItem.badgeValue = unreadCount;

Note that you don't have to use a UITabbar thats visible in your app, you are simple stealing the badge resource.


I'm sure it's not available for developers since Apple doesn't like to reuse assets for different purposes. Those badges have one definitive and simple purpose -- show the number of updates on the app icon. That's the only purpose they serve.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜