-1

I want to remove the badge number from my iPhone application icon when a user scrolls. I'm using iCarousel class' carouselDidScroll method. Unfortunately, the code I'm using (below) doesn't work, and the badge number remains visible. Any ideas?

- (void)carouselDidScroll:(iCarousel *)carousel
{
    int badge=[[UIApplication sharedApplication] applicationIconBadgeNumber];

    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:badge--];
}
BenjaminRH
  • 11,974
  • 7
  • 49
  • 76
Sonu
  • 937
  • 1
  • 10
  • 39

1 Answers1

1

Because the postfix decrement operator decrements its operand, but it yields its previous (not yet decremented) value. Why not use badge - 1 or --badge instead?

  • okie..this is fine..but if there are 3 badge number on app icon..and while open the app,all 3 badge is disappear..what i want,while i scroll this badge number will disappear one by one. – Sonu May 28 '13 at 07:12
  • @Sweeta Well, that's a different question. –  May 28 '13 at 07:13