• UI基础:UIActionSheet和UIAlterView


    iOS中有两个弹出视图的控件,分别是UIActionSheet和UIAlterView.效果图如下:

         

    主要代码如下:

     1 - (void)viewDidLoad {
     2     [super viewDidLoad];
     3     // Do any additional setup after loading the view, typically from a nib.
     4     UIButton * button1 = [UIButton buttonWithType:UIButtonTypeCustom];
     5     button1.frame = CGRectMake(100, 100, 100, 50);
     6     button1.backgroundColor = [UIColor cyanColor];
     7     [button1 addTarget:self action:@selector(onclick1:) forControlEvents:UIControlEventTouchUpInside];
     8     [self.view addSubview:button1];
     9     
    10     UIButton * button2 = [UIButton buttonWithType:UIButtonTypeCustom];
    11     button2.frame = CGRectMake(100 , 200, 100, 50);
    12     button2.backgroundColor = [UIColor redColor];
    13     [button2 addTarget:self action:@selector(onclick2:) forControlEvents:UIControlEventTouchUpInside];
    14     [self.view addSubview:button2];
    15 }
    16 -(void)onclick1:(UIButton *)btn{
    17     UIActionSheet * actionsheet = [[UIActionSheet alloc]initWithTitle:@"提示信息" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"确认" otherButtonTitles:nil];
    18     [actionsheet showInView:self.view];
    19 }
    20 -(void)onclick2:(UIButton *)btn{
    21     UIAlertView * alterView = [[UIAlertView alloc]initWithTitle:@"警告" message:@"您的言论违法中华人民共和国法律,有可能查你水表" delegate:self cancelButtonTitle:@"继续发表" otherButtonTitles:nil];
    22     [alterView show];
    23 }
  • 相关阅读:
    2.Android之按钮Button和编辑框EditText学习
    《DSP using MATLAB》Problem 3.8
    《DSP using MATLAB》Problem 3.7
    《DSP using MATLAB》Problem 3.6
    《DSP using MATLAB》Problem 3.5
    《DSP using MATLAB》Problem 3.4
    《DSP using MATLAB》Problem 3.3
    《DSP using MATLAB》Problem 3.2
    《DSP using MATLAB》Problem 3.1
    《DSP using MATLAB》Problem 2.20
  • 原文地址:https://www.cnblogs.com/shaoting/p/4750732.html
Copyright © 2020-2023  润新知