CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like SVProgressHUD in your projects. First, add the following line to your Podfile:
pod 'LEEAlertView'
Second, install LEEAlertView
into your project:
pod install
Drag the LEEAlertView/LEEAlertView/LEEAlertView folder into your project.
Even though LEEAlertView
is written in Objective-C, it can be used in Swift with no hassle. If you use CocoaPods add the following line to your Podfile:
use_frameworks!
If you added LEEAlertView manually, just add a bridging header file to your project with the LEEAlertView header included.
[LEEAlertViewController showWithTitle:@"警告" message:@"helloWoeld"];
[LEEAlertViewController showWithTitle:@"提示" message:@"你好啊" alertType:UIAlertControllerStyleActionSheet actionTitles:@[@"你", @"我"] handles:@[^(UIAlertAction *action){
NSLog(@"你");
}, ^(UIAlertAction *action){
NSLog(@"我");
}]];
[LEEAlertViewController setCancleActionStyle:0];
[LEEAlertViewController setDestructiveActionStyle:1];
[LEEAlertViewController showWithTitle:@"提示" message:@"你好啊" alertType:UIAlertControllerStyleActionSheet actionTitles:@[@"取消", @"警告"] handles:@[^(UIAlertAction *action){
NSLog(@"取消");
}, ^(UIAlertAction *action){
NSLog(@"警告");
}]];
[LEEAlertViewController showTextFieldWithTitle:@"提示" message:@"你好啊" actionTitles:@[@"取消"] handles:@[^(UIAlertAction *action){
NSLog(@"输入的用户名%@",self.textField.text);
}] textFieldHandles:@[^(UITextField * _Nonnull textField){
textField.placeholder = @"登录";
self.textField = textField;
},^(UITextField * _Nonnull textField){
textField.placeholder = @"密码";
}]];
LEEAlertView is distributed under the terms and conditions of the MIT license. The success, error and info icons are made by Freepik from Flaticon and are licensed under Creative Commons BY 3.0.
if has some problem,send me msg: [email protected], thanks~