代码:
封装部分:
#pragma - mark - AlertController 封装
+(void)showCyAlertInController:( UIViewController * __nullable) controller
Title:(NSString * __nullable)title
Message:(NSString * __nullable)message
ButtonsTitleArray:(NSArray *)buttonsTitleArray
Handler:(void (^)(int selectedIndex))handler
{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
message:message
preferredStyle:UIAlertControllerStyleAlert ];
//空按钮集合
if (buttonsTitleArray.count<1) {
return;
}
//分配事件
for (int i=0; i<buttonsTitleArray.count; i++) {
NSString *btnTitle=buttonsTitleArray[i];
UIAlertAction *actions = [UIAlertAction actionWithTitle:btnT