Skip to content

tezpark/TezAlertView

Repository files navigation

GitHub platform GitHub language GitHub license Travis

TezAlertView

Custom singleton alertView with block completion.

  • Simple custom alertView.
  • Using completion block and singleton.
  • Next commit is auto dismiss alert.

ios simulator screen shot 2015 5 31 9 27 40 ios simulator screen shot 2015 5 31 9 28 16

Installation

CocoaPods

TezAlertView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "TezAlertView"

Usage

TezAlertView *alertView = [[TezAlertView alloc] init];
[alertView showAlertViewWithTitle:@"This is Title!"
                          message:@"I am a message"
               dismissButtonTitle:@"Ok"
                     dismissBlock:^{
                         NSLog(@"Dismiss Block!");
                     }];
            
/************            
  Singleton
************/
[[TezAlertView sharedInstance] showAlertViewWithTitle:@"This is Title!"
                                   dismissButtonTitle:@"Ok"
                                         dismissBlock:^{
                                             NSLog(@"Dismiss Block!");
                                         }];
                                         
[[TezAlertView sharedInstance] showAlertViewWithMessage:@"I am a message"
                                     dismissButtonTitle:@"Ok"
                                           dismissBlock:^{
                                             NSLog(@"Dismiss Block!");
                                         }];

[[TezAlertView sharedInstance] showAlertViewWithTitle:nil
                                              message:@"I am a message"
                                   dismissButtonTitle:@"Ok"
                                         dismissBlock:^{
                                             NSLog(@"Dismiss Block!");
                                         }];

[[TezAlertView sharedInstance] showAlertViewWithTitle:@"This is Title!"
                                              message:@"I am a message"
                                   dismissButtonTitle:@"Ok"
                                    cancelButtonTitle:@"Close"
                                         dismissBlock:^{
                                             NSLog(@"Dismiss Block!");
                                         } cancelBlock:^{
                                             NSLog(@"Cancel Block!");
                                         }];

[[TezAlertView sharedInstance] showAlertViewWithTitle:@"This is Title!"
                                   dismissButtonTitle:@"Ok"
                                    cancelButtonTitle:@"Close"
                                         dismissBlock:^{
                                             NSLog(@"Dismiss Block!");
                                         } cancelBlock:^{
                                             NSLog(@"Cancel Block!");
                                         }];

[[TezAlertView sharedInstance] showAlertViewWithMessage:@"I am a message"
                                   dismissButtonTitle:@"Ok"
                                    cancelButtonTitle:@"Close"
                                         dismissBlock:^{
                                             NSLog(@"Dismiss Block!");
                                         } cancelBlock:^{
                                             NSLog(@"Cancel Block!");
                                         }];

License

The MIT License (MIT)

Copyright (c) 2015 Taesun Park

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.