首页 > 其他 > 详细

UIAlertController

时间:2016-05-07 12:59:29      阅读:261      评论:0      收藏:0      [点我收藏+]
  • 创建弹框控制器
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"请输入团购信息" message:nil preferredStyle:UIAlertControllerStyleAlert];

     

  • 添加按钮
    [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
    [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:nil]];

     

  • 添加文本输入框
    [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
          textField.placeholder = @"请输入团购名字";
      }];
    [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
          textField.placeholder = @"请输入团购价格";
      }];

     

  • 显示控制器
    [self presentViewController:alert animated:YES completion:nil];

     

最终效果

技术分享

UIAlertController

原文:http://www.cnblogs.com/luoze/p/5467943.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!