Skip to content

Instantly share code, notes, and snippets.

@bjhomer
Last active August 29, 2015 14:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjhomer/b633149338ed4114d2a8 to your computer and use it in GitHub Desktop.
Save bjhomer/b633149338ed4114d2a8 to your computer and use it in GitHub Desktop.
Requirements for a good UIAlertView+Blocks implementation
  1. Must have a method similar to -addButtonWithTitle:handler:
  2. Must still work if some buttons are added using the old -addButtonWithTitle: API.
  3. Must still allow setting a delegate, and the delegate must work.

Note that #2 means that handler blocks must not simply be added to an array and located by button index, as there may be more buttons than there are handlers. This is a common error in popular implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment