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

benblakely/BBActionSheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BBActionSheet

Life is easier with blocks but UIActionSheet was built in a time before blocks. Enter BBActionSheet.

With BBActionSheet it’s far easier to keep code nice and simple, especially when you need to pass around an object. For example:

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
    BBToDo *toDo = [[self toDos] objectAtIndex:[indexPath row]];
    
    BBActionSheet *actionSheet = [[BBActionSheet alloc] initWithTitle:NSLocalizedString(@"Options", nil)];
    
    [actionSheet addButtonWithTitle:NSLocalizedString(@"Move to list…", nil) clicked:^{
        [self chooseListForToDo:toDo];
    }];
    
    [actionSheet addDestructiveButtonWithTitle:NSLocalizedString(@"Delete", nil) clicked:^{
        [self deleteToDo:toDo];
    }];
    
    [actionSheet addCancelButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
    [actionSheet showInView:[self view]];
}

Installation

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

About

A block-enhanced UIActionSheet.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published