Reputation: 519
How can we display #of items in a category displayed in a particular UITableViewCell? For example, in iPhone mail app, they show # of new emails in each account..
Thanks Jignesh
Upvotes: 1
Views: 401
Reputation: 32681
Simply customize your UITableViewCell
(see here) and add a custom UILabel
as a subview of your cell so it displays on the right.
If you want to make this UILabel to look like the ones in Mail, this is quite simple, as you may try sthg like this:
countLabel = [[[UILabel alloc] initWithFrame:CGRectMake(140,10,60,24)] autorelease];
countLabel.textColor = [UIColor whiteColor];
countLabel.layer.backgroundColor = [UIColor grayColor].CGColor;
countLabel.layer.cornerRadius = countLabel.bounds.size.height / 2;
countLabel.masksToBounds = YES;
[cell.contentView addSubview:countLabel];
countLabel.text = [categoryItems count];
(Note: to use the layer property of UILabel, don't forget to add the QuartzCore framework and #import <QuartzCore/QuartzCore.h>
)
Upvotes: 3