0

I am recently working on a chat app. I have a trouble here about handling the incoming messages.

I have a tableview which shows all the dialog that i have. Once i receive the new messages i want to add some numbers (which is similar to the badges on the app) on the icon of that cell. I try to add a subview to the cell at the upper-left of the corner? I am not quite sure about this.What can i do to implement this?

The table view cell's image

3
  • Adding an Image View and Label on top of it is the right approach. So are you facing any problem?
    – Taha Samad
    Mar 4, 2015 at 15:05
  • i mean does it have to be so complicated? i don't know if there is a simpler approach?
    – Bill
    Mar 4, 2015 at 15:09
  • AFAIK there isn't any other method. There is built-in support for adding badge over Tab Bar Controller's tab or App Icon, but not image view.
    – Taha Samad
    Mar 4, 2015 at 15:10

1 Answer 1

1

The easiest way is to use https://github.com/Marxon13/M13BadgeView pod library. Simply add badge view to a cell image like in sample bellow:

M13BadgeView *badgeView = [[M13BadgeView alloc] initWithFrame:CGRectMake(0, 0, 24.0, 24.0)];
badgeView.text = @"1";
[cell.imageView addSubview:badgeView];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.