Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Badge icon resource/view

Tags:

iphone

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.

like image 611
Paul Alexander Avatar asked Jan 19 '11 00:01

Paul Alexander


1 Answers

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.

like image 84
WrightsCS Avatar answered Sep 30 '22 17:09

WrightsCS