PHP群:95885625 Hbuilder+MUI群:81989597 站长QQ:634381967
    您现在的位置: 首页 > 开发编程 > iOS开发教程 > 正文

    iOS UIAlertController

    作者:张志勇来源:原创浏览:时间:2020-09-30 00:07:50我要评论
    导读://UIAlertController 代替 UIAlertView#pragma mark ——————弹窗封装-(void)alertControllerView:(NSString *)message{ UIAle...
    //UIAlertController  代替  UIAlertView
    #pragma mark ——————弹窗封装

    -(void)alertControllerView:(NSString *)message

    {

        UIAlertController *alertController = [UIAlertController alertControllerWith :@"提示" message:message preferredStyle:(UIAlertControllerStyleAlert)];

        [NSTimer scheduledTimerWithTimeInterval:1.0f

                                         target:self

                                       selector:@selector(timerFireMethod:)

                                       userInfo:alertController

                                        repeats:YES];

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

    }

     

    - (void)timerFireMethod:(NSTimer*)theTimer//弹出框

    {

        UIAlertController * alertController = (UIAlertController*)[theTimer userInfo];

        [alertController dismissViewControllerAnimated:YES completion:nil];

        alertController = NULL;

    }

     
     
    //UIAlertController  替代  UIActionSheet

        //点击头像实现

     1.

        UIAlertController * alertController = [UIAlertController alertControllerWith : nil                                                                             message: nil                                                                       preferredStyle:UIAlertControllerStyleActionSheet];

        2.

        [alertController addAction: [UIAlertAction actionWith : @"拍照" style: UIAlertActionStyleDefault handler:^(UIAlertAction *action) {

            //拍照

        }]];

        [alertController addAction: [UIAlertAction actionWith : @"从相册选取" style: UIAlertActionStyleDefault handler:^(UIAlertAction *action){

            //相册

        }]];

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

        3.

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


    转载请注明(B5教程网)原文链接:https://b5.mxunkeji.com/content-155-5990-1.html
    相关热词搜索:
    上一篇:第一页