Giter VIP home page Giter VIP logo

dtalertview's Introduction

DTAlertView

Perview 1Perview 2

Custom alert view to solved the UIAlertView can't addSubview problem on iOS7.

NEW Feature:

New effect for show and dismiss animations.

  • DTAlertViewAnimationSlideTop

Slide to top

  • DTAlertViewAnimationSlideBottom

Slide to bottom

  • DTAlertViewAnimationSlideLeft

Slide to left

  • DTAlertViewAnimationSlideRight

Slide to right

And also can use different dismiss animation at click different button.

Use different animation

New method -showForPasswordInputWithAnimation: for input password scenario, and animation -shakeAlertView for password error scenario.

Password error

##ATTENTION##

  • This demo code create on Xcode 5.0, but probably have issues on Xcode 4 or less.
  • Demo code use at non-ARC mode, but DTAlertView main class support ARC and non-ARC mode.

##Q & A##

Q: How to hidden status bar when alert presented on iOS 7?

A: Set UIViewControllerBasedStatusBarAppearance to NO in your info.plist, the status bar won't appear again.

##Installation##

  1. Add QuartzCore framework.
  2. Drag the DTAlertView folder into your project.

##Usage##

Import the header file and declare in want to used class.

#import "DTAlertView.h"

###Initializing DTAlertView in your class:###

// initial for class method
DTAlertView *alertView = [DTAlertView alertViewWithTitle:@"Demo" message:@"This is normal alert view." delegate:nil cancelButtonTitle:@"Cancel" positiveButtonTitle:@"OK"];

// inital for instance method
DTAlertView *alertView = [[DTAlertView alloc] initWithTitle:@"Demo" message:@"This is normal alert view." delegate:nil cancelButtonTitle:@"Cancel" positiveButtonTitle:@"OK"];

and you can use Block with alert view:

DTAlertViewButtonClickedBlock block = ^(DTAlertView *_alertView, NSUInteger buttonIndex, NSUInteger cancelButtonIndex){
	// You can get button title of clicked button.
    NSLog(@"%@", _alertView.clickedButtonTitle);
};

DTAlertView *alertView = [DTAlertView alertViewUseBlock:block title:@"Demo" message:@"This is normal alert view with block." cancelButtonTitle:@"Cancel" positiveButtonTitle:nil];

###Show & dismiss:###

Show alert view:

[alertView show];

Dismiss alert view:

[alertView dismiss];

##Install Code Snippet## Copy codesnippet files under Code Snippet folder to ~/Library/Developer/Xcode/UserData/CodeSnippets/.

  • If your Xcode is opened, please quit Xcode and reopen Xcode

You can find code snippet at there.

Code Snippet

Or use key word DTAlertViewButtonClickedBlock or DTAlertViewTextDidChangeBlock.

Key Word

##Inatall Document Set##

###USE Xcode Documentation Viewer### Copy com.darktt.DTAlertView.docset file under Docset folder to ~/Library/Developer/Shared/Documentation/DocSets/.

  • If your Xcode is opened, please quit Xcode and reopen Xcode

You can find it in Documentation Viewer.

###Use Dash### Add com.darktt.DTAlertView.docset file under Docset folder on Dash preferences.

Dash preferences

##License## Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied.
See the License for the specific language governing permissions
and limitations under the License.

dtalertview's People

Contributors

darktt avatar shouian avatar

Stargazers

 avatar

Watchers

 avatar  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.