Giter Club home page Giter Club logo

prcompatiblealertcontroller's Introduction

PRCompatibleAlertController

Compatible(<= iOS8) UIAlertController written in Objective C

iOS 8 included the new UIAlertController which is upgrading the UIAlertView; however, if your app is still supporting lower version of iOS 8, like most of us are, then you still need to use UIAlertViews.

CompatibleAlertController is supporting iOS 8 & lower version and it emulates the UIAlertController.

How to Use

Code samples are provided in the demo project. You'll find this easy, if you're familiar with the UIAlertController.

Intialize the CompatibleAlertController:

     compatibleAlertController = [CompatibleAlertController compatibleAlertControllerWithTitle:@"TITLE"
                                                                                  message:@"Message" 
                                                                        preferedStyle:CompatibleAlertControllerStyleAlert];

Add actions/buttons to the compatibleAlertController :

    CompatibleAlertAction *defalutAction = [CompatibleAlertAction compatibleActionWithTitle:@"DEFAULT"
                                                                                    style:CompatibleAlertActionStyleDefault
                                                                                    handler:^(CompatibleAlertAction*action){
                                                                                        NSLog(@"DEFAULT ....");
                                                                                    }];
    [compatibleAlertController addAction:defalutAction];

If you want to use another type of button, you can simply use by changing the param for style of CompatibleAlertActionStyle.

Present the compatibleAlertController:

   [compatibleAlertController presentCompatibleAlertController:self
                                                   animated:YES
                                                 completion:^{
                                                     //DO SOMETHING...
                                                 }];

To Do

  1. You need to retain the "CompatibleAlertController" in iOS 7, otherwise when selecting a button from the "UIAlertView" you'll get an exception.
  2. Tests!
  3. Probably a lot more! PR's are welcome.

License

"PRCompatibleAlertController" is licensed under the MIT License. See LICENSE for details.

prcompatiblealertcontroller's People

Contributors

mobiniuspabitraranjan avatar pabitranjan3 avatar

Watchers

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