zoukankan      html  css  js  c++  java
  • UIAlertController 的简单使用方法

    - (void)viewDidLoad {

        [super viewDidLoad];

        UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];

        btn.frame=CGRectMake(10, 60, 80, 30);

        [btn setTitle:@"提示框" forState:UIControlStateNormal];

        btn.backgroundColor=[UIColor redColor];

        [btn addTarget:self action:@selector(gotoAlertVC) forControlEvents:UIControlEventTouchUpInside];

        [self.view addSubview:btn];

    }

    -(void)gotoAlertVC{

        UIAlertController *alertVC=[UIAlertController alertControllerWithTitle:@"提示信息" message:@"iOSQQ技术交流群436337987" preferredStyle:UIAlertControllerStyleAlert];

        UIAlertAction *sureAction=[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

            NSLog(@"确定加入");

        }];

        UIAlertAction *cancelAction=[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {

            NSLog(@"取消加入");

        }];

        [alertVC addAction:sureAction];

        [alertVC addAction:cancelAction];

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

    }

  • 相关阅读:
    四轴PID思路整理
    STM32输入捕获TIM2四通道
    四轴和遥控器的对应
    四层板学习(二)
    四层板学习(一)布线前的准备
    冲突的处理方法
    散列表
    重设置电脑时间
    深圳销量统计源码分析
    源码分析
  • 原文地址:https://www.cnblogs.com/shao621/p/5112753.html
Copyright © 2011-2022 走看看