Coder Social home page Coder Social logo

alert's Introduction

Alert

• Screenshots and Gifs

SS1

SS2

SS3

• Installation

Just drag and drop the "Alert" folder into your project, and make sure you check the "Copy items into destination group's folder" box. Then import Alert.h wherever you need it. If you want delegate methods such as AlertWillAppear or AlertDidDisappear then import the AlertDelegate wherever you need it as well.

#import "Alert.h"

@interface ViewController () <AlertDelegate>

• Creating Alerts

Creating an Alert is easy: Add a title, and a duration (in seconds) and that's it. If you want your alert to be endless you can simply put "0.0" in the duration and you can dismiss it manually.

    Alert *alert = [[Alert alloc] initWithTitle:@"I'm an alert!" duration:1.0 completion:^{
        //Custom code here after Alert disappears
    }];
    [alert setDelegate:self] //Optional - if you want delegate methods
    [alert showAlert];

• Setting Alert Visual Attributes

- Alert colors

You can set Alert's background and title color. Use AlertTypes if you want to use our custom colors.

[alert setBackgroundColor:[UIColor whiteColor]];
[alert setTitleColor:[UIColor blackColor]];

• Setting Incoming and Outgoing Transitions

- Incoming Transitions

Alert has 7 incoming transition types that can be used to add an animation while presenting your Alert.

[alert setIncomingTransition:AlertIncomingTransitionTypeFlip];
- Outgoing Transitions

Alert has 7 outgoing transition types that can be used to add an animation while dismissing your Alert.

[alert setOutgoingTransition:AlertOutgoingTransitionTypeSlideToTop];
- Bounces

Do you want your Alert to bounce when it is transitioning in or do you want smooth sliding? You can be the judge of that.

[alert setBounces:bounces];
- Status Bar

If you don't want the status bar to be shown when you show your Alert, you can easily hide it. If you chose to do this, you must set "View controller-based status bar appearance" = NO in your Info.plist

[alert setShowStatusBar:YES];
- Alert Types

Alert has 3 types that can be used to color the background of your Alert.

[alert setAlertType:AlertTypeError] //Red
[alert setAlertType:AlertTypeSuccess] //Blue
[alert setAlertType:AlertTypeWarning] //Yellow

• Delegate Methods

- Appear and Disappear

Set Alerts's delegate functions to tell when your Alert is appearing or disappearing.

- (void)alertWillAppear:(Alert *)alert;
- (void)alertDidAppear:(Alert *)alert;
- (void)alertWillDisappear:(Alert *)alert;
- (void)alertDidDisappear:(Alert *)alert;

• To-do

  • Add more transitions
  • Make transitions smoother
  • Fix some issues with the demo

• Say Hi

Tweet at me or something : @markmiscavage.

• License

The MIT License (MIT)

Copyright (c) 2015 Mark Miscavage

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

alert's People

Contributors

miscavage avatar

Watchers

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