Latest 0.0.4
Homepage https://github.com/yatatsu/TKAlertController
License MIT
Platforms ios 6.0, requires ARC
Authors

TKAlertController supports both UIAlertView (or UIActionSheet) and UIAlertController.

About

  • TKAlertController is UIAlertController for under iOS8.
  • In iOS8, It works as UIAlertController.
  • And in previous OS version, It works as UIAlertView or UIAcitonSheet.
  • You can use it in same way for any versions.
  • It works in both Xcode 6beta and 5x.

Known issue

  • It does not support delegates about UITextField in UIAlertView.
  • When UIAlertController show, ViewWillDisapper: is not called. (but in TKAlertController, it’s called.)
  • Rotate device when alert is presented, layout will broken. (freeze previous orientation)

Usage

  1. First we create TKAlertController, as UIAlertController.
UIViewController *alertController =
[TKAlertController alertControllerWithTitle:@"title"
                                    message:@"message"
                             preferredStyle:TKAlertControllerStyleAlert];

TKAlertControllerStyleAlert is insted of UIAlertContollerStyleAlert.

and TKAlertControllerStyleActionSheet is instead of UIAlertControllerStyleActionSheet.

  1. Second, we prepare TKAlertAction as UIAlertAction.
TKAlertAction *cancelAction =
     [TKAlertAction actionWithTitle:kButtonTitleCancel
                              style:TKAlertActionStyleCancel
                            handler:^(TKAlertAction *action) {
                            // something to do.
                            }];

TKAlertAction *OKAction =
     [TKAlertAction actionWithTitle:kButtonTitleOK
                              style:TKAlertActionStyleDestructive
                            handler:^(TKAlertAction *action) {
                            // something to do.
                            }];
  1. then, add action to controller.
[alertController addAction:cancelAction];
[alertController addAction:OKAction];
  1. finally, call the method to show.
[self presentTKAlertController:alertController animated:YES completion:^{
      // 
}];

presentTKAlertController:animated:completion: is in category in UIViewController.

LICENSE

MIT

Latest podspec

{
    "name": "TKAlertController",
    "version": "0.0.4",
    "summary": "UIAlertController for and under iOS8",
    "homepage": "https://github.com/yatatsu/TKAlertController",
    "license": "MIT",
    "authors": {
        "kitagawa": "[email protected]"
    },
    "platforms": {
        "ios": "6.0"
    },
    "source": {
        "git": "https://github.com/yatatsu/TKAlertController.git",
        "tag": "0.0.4"
    },
    "source_files": "TKAlertController/*.{h,m}",
    "exclude_files": [
        "TKAlertControllerSample",
        "TKAlertControllerTests"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This