Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

benblakely/BBAlertView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BBAlertView

Life is easier with blocks but UIAlertView was built in a time before blocks. Enter BBAlertView.

With BBAlertView it’s far easier to keep code nice and simple, especially when you have multiple alert views per view controller or you need to pass around an object. For example:

- (void)renameNote:(BBNote *)note {
    BBAlertView *alertView = [[BBAlertView alloc] initWithTitle:NSLocalizedString(@"Rename Note", nil) message:nil cancelButtonTitle:NSLocalizedString(@"Cancel", nil)];
    
    [alertView setAlertViewStyle:UIAlertViewStylePlainTextInput];
    
    [alertView addButtonWithTitle:NSLocalizedString(@"Rename", nil) clicked:^(BBAlertView *alertView) {
        UITextField *nameField = [alertView textFieldAtIndex:0];
        [note setName:[nameField text]];
    }];
    
    [alertView show];
}

Installation

  1. Download the files.
  2. Copy BBAlertView.h and BBAlertView.m into your project’s directory.
  3. Drag the files into Xcode.
  4. Add #import "BBAlertView.h" to your project’s prefix header, e.g. MyApp-Prefix.pch.
  5. Enjoy!

About

A block-enhanced UIAlertView.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published