zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    linux 下spyder安装
    【C++】fill函数,fill与memset函数的区别
    【tensorflow使用笔记一】:安装linux下tensorflow环境的问题
    leetcode 49 字母异位词分组
    leetcode 1014. 在 D 天内送达包裹的能力
    【C++进阶:STL常见性质3】
    【C++进阶:STL常见性质2】
    【C++进阶:STL常见性质】
    【C++进阶:移位运算符的用法】
    面向对象之静态方法
  • 原文地址:https://www.cnblogs.com/zkzzkz/p/5068553.html
Copyright © 2011-2022 走看看