iOS7兼容自定义带动画的AlertViewController

来源:互联网 发布:淘宝保健品规则 编辑:程序博客网 时间:2024/05/16 19:30

preface: Meaning is to create a more versions compatible with similar to UIAlertView controls

pic example:

Gif example:

Advantages

  • iOS 7.0 available after
  • Header Image (optional)
  • Title, des (optional)
  • Low coupling (present new controller)
  • Animation with UIKit Dynamics

Features

  • Provide the expansion of the more interesting and powerful features

Cocoapods

  • Add pod 'XTAlertViewController', '~> 1.0.1' to your Podfile
  • Run pod install or pod update –no-repo-update
  • import <XTAlertView.h>

Usage

        // init obj        XTAlertViewController *xt = [[XTAlertViewController alloc] init];        // Give a picture name        // Give a picture's height        // Give a btn's title array        // Give a title        // Give a describtion        // Give a style  two btn | double btn        // example 1        [xt initWithImage:@"summerxx" imageHeight:0 title:@"This is an introduction" btnTitles:@[@"Cancel", @"Determine"] des:@"A simple and easy to use more version using the controls Copyright © 2016年 夏天然后. All rights reserved." style:AlterDefault];        [self presentViewController:xt animated:YES completion:^{        }];        // example 2        [xt initWithImage:@"summerxx" imageHeight:200 title:@"This is an introduction" btnTitles:@[@"Cancel", @"Determine", @"summerxx"] des:@"A simple and easy to use more version using the controls Copyright © 2016年 夏天然后. All rights reserved." style:AlterDouble];        // present VC        [self presentViewController:xt animated:YES completion:^{        }];

If you use a proxy method

    // Signed an delegate    @interface ViewController ()<XTAlertControllerDelegate>    //     xt.delegate = self;

Implement delegate method like this

- (void)xt_alertViewControllerClickIndex:(NSInteger)buttonIndex{    switch (buttonIndex) {        case 0:            NSLog(@"0");            NSLog(@"Cancel");        break;        case 1:            NSLog(@"1");            NSLog(@"Determine");        break;        case 2:            NSLog(@"2");            NSLog(@"summerxx");        break;        default:        break;    }}

Contributing

  • If you need help, open an issue.
  • If you found a bug, open an issue.
  • If you have a new demand, also open an issue.

Acknowledgements

Made with by summerxx27 , Thank you for your use

MIT License

XTAlertController is available under the MIT license. See the LICENSE file for more info.

轮子地址- https://github.com/summerxx27/XTAlertVC

0 0