Coder Social home page Coder Social logo

nzalertview's Introduction

#NZAlertView License MIT

Simple and intuitive alert view. Similar to push notification effect. This class uses UIAlertView default methods and protocols.

NZAlertView


NZAlertView


[![Build Status](https://api.travis-ci.org/NZN/NZAlertView.png)](https://api.travis-ci.org/NZN/NZAlertView.png) [![Cocoapods](https://cocoapod-badges.herokuapp.com/v/NZAlertView/badge.png)](http://beta.cocoapods.org/?q=NZAlertView) [![Cocoapods](https://cocoapod-badges.herokuapp.com/p/NZAlertView/badge.png)](http://beta.cocoapods.org/?q=NZAlertView) [![Analytics](https://ga-beacon.appspot.com/UA-48753665-1/NZN/NZAlertView/README.md)](https://github.com/igrigorik/ga-beacon)

Requirements

NZAlertView works on iOS 6.0+ version and is compatible with ARC projects. It depends on the following Apple frameworks, which should already be included with most Xcode templates:

  • Foundation.framework

You will need LLVM 3.0 or later in order to build NZAlertView.

NZAlertView use UIImage-Helpers project for manipulating images.

Adding NZAlertView to your project

Cocoapods

CocoaPods is the recommended way to add NZAlertView to your project.

  • Add a pod entry for NZAlertView to your Podfile:
pod 'NZAlertView'
  • Install the pod(s) by running:
pod install

Source files

Alternatively you can directly add source files to your project.

  1. Download the latest code version or add the repository as a git submodule to your git-tracked project.
  2. Open your project in Xcode, then drag and drop all files at NZAlertView folder onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.

Usage

###Info

  • Works at iPad and iPhone
  • Works with or without status bar
  • Only works at portrait mode
  • The alert duration time can be modified (default: 5 seconds)
  • The animation duration time can be modified (default: 0.6 seconds)
  • The text alignment can be changed (default: left alignment)
  • Only 1 alert is displayed at a time
  • Delegates are similar to UIAlertView

###Styles

  • NZAlertStyleError
  • NZAlertStyleSuccess
  • NZAlertStyleInfo

###Show

#import "NZAlertView.h"
...
{
    // There are several ways to init, just look at the class header
    NZAlertView *alert = [[NZAlertView alloc] initWithStyle:NZAlertStyleSuccess
                                                      title:@"Alert View"
                                                    message:@"This is an alert example."
                                                   delegate:nil];
                                                   
    [alert setTextAlignment:NSTextAlignmentCenter];

	[alert show];      
	
	// or
	
	[alert showWithCompletion:^{
    NSLog(@"Alert with completion handler");
	}];                                            
}

###Delegate

  • All delegates are optional
#import "NZAlertViewDelegate.h"
...

- (void)willPresentNZAlertView:(NZAlertView *)alertView;
- (void)didPresentNZAlertView:(NZAlertView *)alertView;

- (void)NZAlertViewWillDismiss:(NZAlertView *)alertView;
- (void)NZAlertViewDidDismiss:(NZAlertView *)alertView;

###Setters and getters

@property (nonatomic, assign) id delegate;
@property (nonatomic, assign) NZAlertStyle alertViewStyle;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *message;
@property (nonatomic, readonly, getter = isVisible) BOOL visible;

@property (nonatomic, assign) NSString *fontName;
@property (nonatomic) NSTextAlignment textAlignment;
@property (nonatomic, assign) CGFloat alertDuration;
@property (nonatomic, assign) CGFloat animationDuration;
@property (nonatomic, assign) CGFloat screenBlurLevel;

###Images and colors

  • If you want to change, the images are in the bundle: NZAlertView-Icons.budle
  • To customize the colors, extend the NZAlertViewColor class and override the methods: errorColor, infoColor and successColor.

License

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

Change-log

A brief summary of each NZAlertView release can be found on the wiki.

##To-do Items

###Orientation

  • Support for landscape mode

###Design

  • Add style with buttons
  • Create a NZAlertStyleCustom style

nzalertview's People

Contributors

bofiaza avatar justinjiadev avatar

Watchers

James Cloos avatar denty 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.