|
1 | 1 | # TYAlertController
|
2 |
| -Powerful, easy to use alertView or popView on controller and window, support custom view and animation |
| 2 | +Powerful, Easy to use alertView or popupView on controller and window, support blur effect, custom view and custom animation, use aotolayout. |
| 3 | + |
| 4 | +### ScreenShot |
| 5 | + |
| 6 | + |
| 7 | +### Requirements |
| 8 | +* Xcode 5 or higher |
| 9 | +* iOS 7.0 or higher |
| 10 | +* ARC |
| 11 | + |
| 12 | +### Usage |
| 13 | + |
| 14 | +1.copy TYAlertController Folder to your project, if you want to have blur effect ,you need copy Blur Effects Folder to your project.<br> |
| 15 | +2. #import "UIView+TYAlertView.h", when you use it, if you want use blur effect, #import "TYAlertController+BlurEffects.h".<br> |
| 16 | +3. you can use TYAlertController show in controller, or use TYShowAlertView show in window, or use Category UIView+TYAlertView convenient show alertview.<br> |
| 17 | +4. check Demo,it have more usefull usage and example. |
| 18 | + |
| 19 | +### usege demo |
| 20 | + |
| 21 | +* show in controller (tow way) |
| 22 | +```objc |
| 23 | +TYAlertView *alertView = [TYAlertView alertViewWithTitle:@"TYAlertView" message:@"This is a message, the alert view containt text and textfiled. "]; |
| 24 | + |
| 25 | + [alertView addAction:[TYAlertAction actionWithTitle:@"取消" style:TYAlertActionStyleCancle handler:^(TYAlertAction *action) { |
| 26 | + NSLog(@"%@",action.title); |
| 27 | + }]]; |
| 28 | + |
| 29 | + [alertView addAction:[TYAlertAction actionWithTitle:@"确定" style:TYAlertActionStyleDestructive handler:^(TYAlertAction *action) { |
| 30 | + NSLog(@"%@",action.title); |
| 31 | + }]]; |
| 32 | + |
| 33 | + [alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) { |
| 34 | + textField.placeholder = @"请输入账号"; |
| 35 | + }]; |
| 36 | + [alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) { |
| 37 | + textField.placeholder = @"请输入密码"; |
| 38 | + }]; |
| 39 | + |
| 40 | + // first way to show |
| 41 | + TYAlertController *alertController = [TYAlertController alertControllerWithAlertView:alertView preferredStyle:TYAlertControllerStyleAlert]; |
| 42 | + //alertController.alertViewOriginY = 60; |
| 43 | + [self presentViewController:alertController animated:YES completion:nil]; |
| 44 | + |
| 45 | + // second way to show,use UIView Category |
| 46 | + //[alertView showInController:self preferredStyle:TYAlertControllerStyleAlert]; |
| 47 | +``` |
| 48 | +
|
| 49 | +* show in window (tow way) |
| 50 | +```objc |
| 51 | +TYAlertView *alertView = [TYAlertView alertViewWithTitle:@"TYAlertView" message:@"A message should be a short, but it can support long message"]; |
| 52 | + |
| 53 | + [alertView addAction:[TYAlertAction actionWithTitle:@"取消" style:TYAlertActionStyleCancle handler:^(TYAlertAction *action) { |
| 54 | + NSLog(@"%@",action.title); |
| 55 | + }]]; |
| 56 | + |
| 57 | + [alertView addAction:[TYAlertAction actionWithTitle:@"确定" style:TYAlertActionStyleDestructive handler:^(TYAlertAction *action) { |
| 58 | + NSLog(@"%@",action.title); |
| 59 | + }]]; |
| 60 | + |
| 61 | + // first way to show ,use UIView Category |
| 62 | + [alertView showInWindowWithOriginY:200 backgoundTapDismissEnable:YES]; |
| 63 | + |
| 64 | + // second way to show |
| 65 | + // [TYShowAlertView showAlertViewWithView:alertView originY:200 backgoundTapDismissEnable:YES]; |
| 66 | +``` |
| 67 | + |
| 68 | +### Contact |
| 69 | +if you find bug,please pull reqeust me <br> |
| 70 | +if you have good idea,contact me, Email:122074809@qq.com |
3 | 71 |
|
0 commit comments