UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"举报" message:@"请选择举报类型" preferredStyle:UIAlertControllerStyleActionSheet];
for (NSString *title in @[@"欺骗",@"虚假宣传",@"涉黄",@"敏感问题 ",@"其他"]) {
UIAlertAction *action = [UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[SVProgressHUD show];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[SVProgressHUD dismiss];
[SVProgressHUD showSuccessWithStatus:@"操作成功!"];
});
}];
[alert addAction:action];
}
UIAlertAction *canenl = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
[alert addAction:canenl];
[self presentViewController:alert animated:true completion:nil];
UIAlertControllerStyleAlert:
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"创建新专辑" message:nil preferredStyle:UIAlertControllerStyleAlert];
UIPopoverPresentationController *popover = alert.popoverPresentationController;
if (popover) {
popover.sourceView = self.view;//展示位置的视图
popover.sourceRect = self.view.bounds;//展示位置的大小
popover.permittedArrowDirections = UIPopoverArrowDirectionAny;
}
[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
textField.placeholder = @"请输入新专辑名称";
// textField.keyboardType = UIKeyboardTypeDecimalPad;
}];
//添加一个确定按钮 并获取AlertView中的第一个输入框 将其文本赋值给BUTTON的title
[alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
UITextField *envirnmentNameTextField = alert.textFields.firstObject;
NSLog(@"你输入的文本======%@",envirnmentNameTextField.text);
NSString *content = envirnmentNameTextField.text;
content = [content stringByReplacingOccurrencesOfString:@" " withString:@""];
if (content.length > 0) {
NSString *timeStr = [KKKLFunc currentDateStr];
NSDictionary *jsonD = @{@"name":content,@"time":timeStr,@"list":@[]};
[weakSelf.zjList addObject:jsonD];
SAVEDEFAULTSS(weakSelf.zjList, @"zjList")
[weakSelf.tableView reloadData];
}
}]];
[alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {}]];
//弹出提示框;
[self presentViewController:alert animated:true completion:nil];