Skip to content

twotoasters/TTAlertView

Repository files navigation

TTAlertView

TTAlertView is a drop-in replacement for UIAlertView that allows the developer to customize the presentation of an alert. TTAlertView uses the familiar interface of UIAlertView, so you don’t have to worry about rewriting any of your code – just drop it in, add some assets, and -bam!- you have a unique, customized alert view for your app!

Installation

If you're using git, you can add TTAlertView as a submodule to your project. Otherwise, you can simply download the latest source from the master branch here on github.

Once you've obtained the TTAlertView project, simply add TTAlertView.h + TTAlertView.m to your xcode project and #include TTAlertView.h in the files you want to use TTAlertView. Now you're set to go!

Usage

Using TTAlertView is simple. TTAlertView uses the familiar initWithTitle:​message:​delegate:​cancelButtonTitle:​otherButtonTitles: and show methods to create and display your alert view. From there TTAlertView handles laying out and animating the view.

Lets see some code:

- (void)simpleAlert
{
    TTAlertView *alert = [[TTAlertView alloc] initWithTitle:@"A Simple TTAlertView" 
                                                    message:@"... with the default layout!" 
                                                   delegate:self 
                                          cancelButtonTitle:@"Dismiss" 
                                          otherButtonTitles:nil];
    [alert show];
}

... which gives you this:

A real simple TTAlertView

This is just a simple example of TTAlertView's use. You can read more about using TTAlertView at ToastMo's blog post on TTAlertView.

License

MIT: http://twotoasters.mit-license.org