LVMAlertHUD 6

LVMAlertHUD 6

wuyikai 维护。



  • 作者
  • wuyikai

LVMAlertController

遵循系统 API 的警报控件。

使用方法

  • 基本的

LVMAlertController *alertController = [LVMAlertController alertControllerWithTitle:@"TITLE" message:@"some message" preferredStyle:LVMAlertControllerStyleAlert];

LVMAlertAction *action = [LVMAlertAction actionWithTitle:@"OK" style:LVMAlertActionStyleDefault handler:nil];
[alertController addAction:action];

action = [LVMAlertAction actionWithTitle:@"Cancel" style:LVMAlertActionStyleCancel handler:^(LVMAlertAction * _Nonnull action) {
    NSLog(@"%@", action.title);
}];
[alertController addAction:action];

[alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
   textField.placeholder = @"A text field placeholder";
}];

[self presentViewController:alertController animated:YES completion:nil];

  • 支持 DSL

LVMAlertController.alert
	          .setupTitle(@"Title")
	          .setupMessage(@"message")
	          .addActionsWithTitles(@"ok", @"later", @"know", nil)
	          .addCancelActionWithTitle(@"cancel")
	          .actionsHandler(^(NSInteger index, LVMAlertAction *action) {
	             NSLog(@"click %ld, %@", index, action.title);
	          })
.show(^{
    NSLog(@"show");
});

其他 UI 控件包括

  • LVMStatusBarHUD
  • LVMToastHUD

使用 CocoaPods 安装

在 Podfile 中添加以下内容。

pod 'LVMAlertHUD'

OR

pod 'LVMAlertHUD/AlertController' 
pod 'LVMAlertHUD/StatusBarHUD'
pod 'LVMAlertHUD/Toast'

兼容性

  • iOS 8.0+
  • Xcode 9.4

许可证

请参阅 LICENSE。