how to remove number of badge one by one while scrolling - iphone

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--];
}

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?

Related

banner badges iPhone

Is there a way to have the banners/badges for my app only update to 1? For example, if I have three notifications/updates for my app, instead of showing the launch icon on the homepage with the number 3, could I just show the number 1?
I guess in essence, I'm asking can I set the max of a badge for the app I am developing for the iPhone?
You set the application badge yourself, so you can determine the algorithm for the number you display. So if you want to just set the badge to 1 if there are any messages, but no badge otherwise, just use something like this:
- (void)applicationWillResignActive:(UIApplication *)application {
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:(numberOfMessages > 0) ? 1 : 0];
}

Reducing badge number with Push notifications

Hi in my application when i receive push notification from server my application badge get incremented by one.and when i open app and close it did not get reduce.so my question is how to reduce badge icon on application icon when user see the notification
You can set it to any value you like. Setting it to 0 removes the badge.
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
I had this same issue, so I thought, "Why not just GET the badge number?" Then, you can do whatever you wish with it.
If you are in your AppDelegate.m file, you could use this in your application: didFinishLaunchingWithOptions: method:
int badgeNumber = [application applicationIconBadgeNumber] -1;
[application setApplicationIconBadgeNumber:badgeNumber];
This will reduce the icon badge number by one. However, be mindful that your user may have multiple notifications from your application that are still not yet viewed. Thus, you should probably set this inside of a particular method that will handle the pushes. Or, depending how your app is set up, just set the badge icon number to 0.
Hope this helps.

Badges, Update item number?

Is it possible to update the badge number without sending the application a push notification?
Such as when the application is loaded you can change the badge number?
Yes. You can use this:
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:3];
This will update the value without using a push notification.

Write some text in (or on) UIStatusBar

I know, it's a strange question ^^,
I would like to know if there is a way to write some text in (or on) the UIStatusBar. In particular I want to write some text on the Status Bar when the user press a UIButton.
Thanks!
I'm not sure if you can draw directly into the status bar, but you should be able to draw on top of it in a custom view. You can get the status bar's frame using:
CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
And you can get the application's main window (presumably the status bar's superview) using:
UIWindow *mainWindow = [[UIApplication sharedApplication] keyWindow];
You should be able to add your custom view directly to the key window in the status bar's frame. For an example of an app that appears to "modify" the status bar, take a look at Reeder.
No, the status bar is a system-controlled element. It's content cannot be modified by a third-party application.
Check out this work in progress: https://github.com/maciekish/APStatusBarExtensions
MTStatusBarOverlay is what you want :
https://github.com/myell0w/MTStatusBarOverlay
Definitely the easier to use !

iPhone unread counts on tabbar

Which is the best way to implement on Cocoa Touch the unread counts on a icon on a TabBar?
I want to mimic the SMS or Mail application behavior, showing the unread message count to the user of my application, with a red dot containing a number.
The property you're looking for is called the badge. You set it by doing something like:
self.tabBarItem.badgeValue = #"1";
Have you looked at: setApplicationBadgeNumber?
[[UIApplication sharedApplication] setApplicationBadgeNumber:int];
For current view I use:
self.navigationController.tabBarItem.badgeValue = #"5";