UIAlertController 2021-08-02

    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];
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 现在而今眼目下,新媒体、互联网飞速发展,线上线下、虚拟现实、国际国内,匿名的、多元的,情势越来越复杂多变,我们辨别...
    嗯_65fd阅读 1,283评论 0 0
  • 【公司】深圳市正大信维通讯设备有限公司 【品牌释译】 正诚通四海 大德成鸿业 信义聚英才 维系万众心 【愿景】成为...
    丁俊友阅读 1,391评论 0 0
  • 都在卿卿我我、没人在乎大自然的谴责!极尽奢糜的浪费自然资源、醉生梦死的短视观念…… 烂人!你从来就没想过过自己繁华...
    何必真阅读 1,418评论 0 0
  • 读者慢慢听我细说。哥哥姐姐有时间读到它了,你们心里的气,有时候我能听出来。海静苦于压抑情愫久矣。不是洗白文,只是直...
    君临进阅读 1,099评论 0 0
  • 本来想打开记录一下昨天的事情,但是打开首页,简书给我推荐了一片陌生人的文章,标题是人设。 人设这个词,总给你感觉一...
    骑猪的书生阅读 1,895评论 0 0

友情链接更多精彩内容