Giter VIP home page Giter VIP logo

urbalertview's Introduction

URBAlertView

Overview

URBAlertView is a block-based alternative to the default UIAlertView available in UIKit that offers easier customization and a wider range of presentation and dismissal animations (fade, zoom, slide, flip, tumble).

Basic two-button layout example Basic two-button layout example with text field

Installation

To use URBAlertView in your own project, just import URBAlertView.h and URBAlertView.m files into your project, and then include "URBAlertView.h" where needed, or in your precompiled header.

The project uses ARC and targets iOS 5.0+.

Usage Examples

The process of displaying an alert is very similar to that of UIKit's UIAlertView, except that you can use block for handling button events instead of the cumbersome delegate method. Just create an instance of URBAlertView, add some buttons and show (or show with a specific presentation style):

URBAlertView *alertView = [URBAlertView alloc] initWithTitle:@"Test Dialog" subtitle:@"This is just a test dialog"];
[alertView addButtonWithTitle:@"Close"];
[alertView addButtonWithTitle:@"OK"];
[alertView setHandlerBlock:^(NSInteger buttonIndex, URBAlertView *alertView) {
	[self.alertView hideWithCompletionBlock:^{
		NSLog(@"Alert view closed.");
	}];
}];
[self.alertView showWithAnimation:URBAlertAnimationFlipHorizontal];

By default, the dismissal animation will be in the same style as the presentation animation, unless you specifically use a different animation style when hiding:

[alertView hideWithAnimation:URBAlertAnimationTumble];

TODO

  • Update to better resemple the init methods found in UIAlertView.
  • Support for defining event handling blocks for each button instead of a single block for all buttons.
  • UIAppearance conformance to allow for easier skinning and styling.
  • Support for setting the UIImage instances to use for backgrounds and buttons without having to edit the core classes.
  • Support for dynamically swapping out the content view without having to display another alert view.

License

This code is distributed under the terms and conditions of the MIT license.

urbalertview's People

Contributors

u10int avatar

Watchers

Leo Pasquini avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.