objective-c UIAlertController 提示框應用

注意:reloadData  只有在View 中的數據發生改變的狀況下。  數組

UIAlertActionStyleCancel------Cancel意思是取消spa

UIAlertActionStyleDefault------正常狀況下使用3d




UIAlertController * alertController=[UIAlertController alertControllerWithTitle:@"提示" message:@"是否刪除?" preferredStyle:UIAlertControllerStyleAlert];orm

    [alertController addAction:[UIAlertAction actionWithTitle:@"肯定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {rem

        //數組按下表刪除it

        [arrayPic removeObjectAtIndex:indexPath.row];io

        //刷新頁面im

        [_collectionView reloadData];數據

    }]];margin

    [alertController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];

    

    [self presentViewController:alertController animated:NO completion:nil];

相關文章
相關標籤/搜索