Skip to content

Commit 8e214c4

Browse files
committed
Update README.md
1 parent 44a747f commit 8e214c4

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,52 @@ Powerful, easy to use alertView or popView on controller and window, support cus
1414
1.copy TYAlertController Folder to your project, if you want to have blur effect ,you need copy Blur Effects Folder to your project.<br>
1515
2. #import "UIView+TYAlertView.h", when you use it, if you want use blur effect, #import "TYAlertController+BlurEffects.h".
1616

17+
### usege demo
18+
19+
* show in controller (tow way)
20+
```objc
21+
TYAlertView *alertView = [TYAlertView alertViewWithTitle:@"TYAlertView" message:@"This is a message, the alert view containt text and textfiled. "];
22+
23+
[alertView addAction:[TYAlertAction actionWithTitle:@"取消" style:TYAlertActionStyleCancle handler:^(TYAlertAction *action) {
24+
NSLog(@"%@",action.title);
25+
}]];
26+
27+
[alertView addAction:[TYAlertAction actionWithTitle:@"确定" style:TYAlertActionStyleDestructive handler:^(TYAlertAction *action) {
28+
NSLog(@"%@",action.title);
29+
}]];
30+
31+
[alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) {
32+
textField.placeholder = @"请输入账号";
33+
}];
34+
[alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) {
35+
textField.placeholder = @"请输入密码";
36+
}];
37+
38+
// first way to show
39+
TYAlertController *alertController = [TYAlertController alertControllerWithAlertView:alertView preferredStyle:TYAlertControllerStyleAlert];
40+
//alertController.alertViewOriginY = 60;
41+
[self presentViewController:alertController animated:YES completion:nil];
42+
43+
// second way to show,use UIView Category
44+
//[alertView showInController:self preferredStyle:TYAlertControllerStyleAlert];
45+
```
46+
47+
* show in window (tow way)
48+
```objc
49+
TYAlertView *alertView = [TYAlertView alertViewWithTitle:@"TYAlertView" message:@"A message should be a short, but it can support long message"];
50+
51+
[alertView addAction:[TYAlertAction actionWithTitle:@"取消" style:TYAlertActionStyleCancle handler:^(TYAlertAction *action) {
52+
NSLog(@"%@",action.title);
53+
}]];
54+
55+
[alertView addAction:[TYAlertAction actionWithTitle:@"确定" style:TYAlertActionStyleDestructive handler:^(TYAlertAction *action) {
56+
NSLog(@"%@",action.title);
57+
}]];
58+
59+
// first way to show ,use UIView Category
60+
//[alertView showInWindowWithOriginY:200 backgoundTapDismissEnable:YES];
61+
62+
// second way to show
63+
[TYShowAlertView showAlertViewWithView:alertView originY:200 backgoundTapDismissEnable:YES];
64+
```
1765

0 commit comments

Comments
 (0)