UIAlertController

来源:互联网 发布:安卓看电影软件 编辑:程序博客网 时间:2024/05/16 13:43

注意:我这里的仅仅限于OC,不适用与SWIFT

1首先创建UIAlertController,这里的UIAlertControllerStyleActionSheet是从底部弹出来的效果样式

    UIAlertController* alertController = [UIAlertControlleralertControllerWithTitle:@"please selctor"message:@""preferredStyle:UIAlertControllerStyleActionSheet];

    2设置名字,,,hander就是给它设置点击事件

    UIAlertAction* cameraAction = [UIAlertActionactionWithTitle:@"xxx"style:UIAlertActionStyleDefaulthandler:^(UIAlertAction *action) {

        

        

    }];

    UIAlertAction* photoAction = [UIAlertActionactionWithTitle:@"xxxx"style:UIAlertActionStyleDefaulthandler:^(UIAlertAction *action) {


    }];

    UIAlertAction* cancelAction = [UIAlertActionactionWithTitle:@"xxxx"style:UIAlertActionStyleDefaulthandler:nil];

    3把Avtion装入容器里面

    [alertControlleraddAction:cameraAction];

    [alertControlleraddAction:photoAction];

    [alertControlleraddAction:cancelAction];

    4模态跳转弹出来

    [selfpresentViewController:alertControlleranimated:YEScompletion:nil];



效果图如:(反正效果就是这样的,图是截取的别人的,有点丑,希望不要介意);


1 0
原创粉丝点击