zoukankan      html  css  js  c++  java
  • UI第十二节-UIAlertView

    - (void)viewDidLoad {
        [super viewDidLoad];
        
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
        btn.frame = CGRectMake(40, 100, 295, 30);
        [btn setTitle:@"Show Alert View" forState:UIControlStateNormal];
        [btn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:btn];
    }

    - (void)btnClicked:(UIButton *)btn
    {
        // 实例化 UIAlertView
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"这是Title" message:@"这里是提示的信息" delegate:self cancelButtonTitle:@"取消按钮" otherButtonTitles:@"确认", nil];
        
        // 显示UIAlertView
        [alertView show];
    }

    // 用户点击UIAlertView上的按钮时会调用这个代理方法
    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    {
        // 通过ButtonIndex来判断用户点击的是哪一个Button
        NSLog(@"%ld, %@", buttonIndex, [alertView buttonTitleAtIndex:buttonIndex]);
    }

  • 相关阅读:
    [转载]宇宙文明等级的划分标准
    常用的AJAX框架
    常用的AJAX框架
    【★】路由环路大总结!
    分销商城

    如何开始做外贸
    时间管理模型
    吕广渝:上帝视角看公司运营
    Java面试必问
  • 原文地址:https://www.cnblogs.com/laolitou-ping/p/6244179.html
Copyright © 2011-2022 走看看