简介
在 Objective-C 或 Swift 项目中使用 AlertView 和 ActionSheet 的简单方法,此库基于 UIAlertViewViewController。
用法
- 在 podfile 中添加仓库
- 使用 pod 'HLAlert' 或将库拖入您的项目文件夹
-
使用 Objective-C
- 导入头文件
#import <HLAlert/HLAlert-Swift.h>
- 编写方法
[HLAlert showAlertWithTitle:@"title" message:@"message" actionTitles:@[@"action1",@"action2"] handler:^(NSInteger idx) {
//do something
}];
-
使用 Swift
- 导入头文件
import HLAlert
- 编写方法
HLAlert.showAlert(title: "title", message: "message", actionTitles: ["action1","action2"]) { (idx) in
// do something
}