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:@"創(chuàng)建新專輯" 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];
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 現(xiàn)在而今眼目下,新媒體、互聯(lián)網(wǎng)飛速發(fā)展,線上線下、虛擬現(xiàn)實(shí)、國際國內(nèi),匿名的、多元的,情勢越來越復(fù)雜多變,我們辨別...
    嗯_65fd閱讀 179評論 0 0
  • 【公司】深圳市正大信維通訊設(shè)備有限公司 【品牌釋譯】 正誠通四海 大德成鴻業(yè) 信義聚英才 維系萬眾心 【愿景】成為...
    丁俊友閱讀 190評論 0 0
  • 都在卿卿我我、沒人在乎大自然的譴責(zé)!極盡奢糜的浪費(fèi)自然資源、醉生夢死的短視觀念…… 爛人!你從來就沒想過過自己繁華...
    何必真閱讀 193評論 0 0
  • 讀者慢慢聽我細(xì)說。哥哥姐姐有時間讀到它了,你們心里的氣,有時候我能聽出來。海靜苦于壓抑情愫久矣。不是洗白文,只是直...
    君臨進(jìn)閱讀 122評論 0 0
  • 本來想打開記錄一下昨天的事情,但是打開首頁,簡書給我推薦了一片陌生人的文章,標(biāo)題是人設(shè)。 人設(shè)這個詞,總給你感覺一...
    騎豬的書生閱讀 306評論 0 0

友情鏈接更多精彩內(nèi)容