• 12.22UIAlertController 使用


    //

    //  ViewController.m

    //  12.22.00UIAlertController

    //

    //  Created by 张凯泽 on 15/12/22.

    //  Copyright © 2015年 rytong_zkz. All rights reserved.

    //

    #import "ViewController.h"

    @interface ViewController ()

    - (IBAction)jumpClick;

    @end

    @implementation ViewController

    - (void)viewDidLoad {

        [super viewDidLoad];

        // Do any additional setup after loading the view, typically from a nib.

    }

    - (void)didReceiveMemoryWarning {

        [super didReceiveMemoryWarning];

        // Dispose of any resources that can be recreated.

    }

    - (IBAction)jumpClick {

        NSString *title = @"是否要退出程序";

        NSString *message = @"退出程序后下次登录会自动更新数据";

        NSString *cancelButtonTitle = @"取消";

        NSString *otherButtonTitle =@"确定";

        

        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleActionSheet];

        

        // Create the actions.

        UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {

            NSLog(@"The "Okay/Cancel" alert's cancel action occured.");

        }];

        //UIAlertActionStyleDestructive 字体为红色字体系统默认

        UIAlertAction *otherAction = [UIAlertAction actionWithTitle:otherButtonTitle style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {

            NSLog(@"The "Okay/Cancel" alert's other action occured.");

        }];

        

        // Add the actions.

        [alertController addAction:cancelAction];

        [alertController addAction:otherAction];

        

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

        

    }

    @end

  • 相关阅读:
    DapperExtensions 使用教程
    C#事件订阅及触发例子
    01、类与结构的区别
    内网信息搜集
    Anydesk拿下远程桌面
    C++对注册表的操作
    Linux下常见流编辑器的使用
    Typecho1.1反序列化漏洞复现
    Nmap脚本编写
    Github学习
  • 原文地址:https://www.cnblogs.com/zkzzkz/p/5068553.html
Copyright © 2020-2023  润新知