Ever wanted to notify the user of your iPhone application of certain events gracefully, like the desktop Growl does? Tweetdeck for the iPhone does it, in a way. Well, now you can too. Hereby I release the source code for IZGrowlManager under BSD license which allows you to do that.
So how does it look like? Here's a screenshot of it in action:
Pretty neat, huh?
You may ask why would someone use something like this to notify the user, there's UIAlertView for this. Growl project leader @boredzo was thinking the same when I asked him if there was a Growl framework for the iPhone which I could use. I must disagree. The main difference between the 2 notification approaches is that the UIAlertView disrupts completely the user's workflow because it doesn't let him/her continue until he/she pushes a button while the Growl approach can be dismissed very quickly also without any user interaction since the bubbles disappear after a while.
I'm sure he misunderstood me.
So, how can you use IZGrowlManager:
When you reach to a point where you want to notify the user of an event then create an IZGrowlNotification instance and pass it to the shared IZGrowlManager instance which takes care of the rest.
IZGrowlNotification *notification = [[IZGrowlNotification alloc] initWithTitle:@"Tip" description:@"Shake the device to reset the route" image:[UIImage imageNamed:@"information-symbol.png"] context:nil delegate:nil];
[[IZGrowlManager sharedManager] postNotification:notification];
[notification release];
If you want to track if the user tapped on the bubble belonging to the notification then set a delegate for the IZGrowlNotification object and implement the (only) delegate method
- (void)didSingleTapOnNotification:(IZGrowlNotification *)notification;
That's it. There are a few tweeks, just read the header file for more info.
Some constraints:
- it's not a framework to interact with any other application on the device or on the desktop. It's a simple notification framework for you to notify the user of your app as if Growl would magically run in the background
- currently there is only this 'Smoke' style available with no ability to modify it via the framework.
- fixed sized notification bubbles only
- 3 notification bubbles at a time. If new notification will come in they will be enqueued and posted when there will be a free spot available
- bubbles will be appearing starting from the bottom right corner
- image will be resized to 30x30
Here's the link again to the source on GitHub if you missed it in the first paragraph.


0 comments:
Post a Comment