美文网首页
ios 的提示框

ios 的提示框

作者: 懿懿懿懿懿懿懿 | 来源:发表于2018-11-19 15:14 被阅读0次

一、UIAlertView

//定义属性
    UIAlertView *AlertView;


  //方法点击显示弹窗
  AlertView = [[UIAlertView alloc]initWithTitle:@"确定" message:@"哈哈" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"多少啊", nil];
//需要show展示出弹窗,不是[self.view addSubView:]
    [AlertView show];
//ios9 以后所用的弹窗
 alert = [UIAlertController alertControllerWithTitle:@"Title" message:nil preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction * alert1 = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        NSLog(@"点击了1");
  //换成点击方法跳转方法

    }];
    UIAlertAction * alert2 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        NSLog(@"点击了2");
  //换成点击方法跳转方法
    }];
    [alert addAction:alert1];
    [alert addAction:alert2];
    [self presentViewController:alert animated:YES completion:nil];

相关文章

网友评论

      本文标题:ios 的提示框

      本文链接:https://www.haomeiwen.com/subject/bvfafqtx.html