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]);
    }

  • 相关阅读:
    jsp JavaBean配置
    jsp response对象
    tomcat 多servlet配置
    jsp session
    什么才是永恒?
    Class Diagram Of elvish ray 0.6 For Reference
    Dataflow
    过生日
    我们开始设计软件架构
    寻回旧作——Mars Princess
  • 原文地址:https://www.cnblogs.com/laolitou-ping/p/6244179.html
Copyright © 2011-2022 走看看