V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
594747343
V2EX  ›  Swift

swift3-提示框问题 [小白]

  •  
  •   594747343 · 2017-06-28 14:55:57 +08:00 · 3171 次点击
    这是一个创建于 2487 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我想要写个点击 button,然后弹出一个提示框的功能

    let alertController = UIAlertController(title: "系统提示", message: "123 ?", preferredStyle: .alert) let cancelAction = UIAlertAction(title: "取消", style: .cancel, handler: nil) let okAction = UIAlertAction(title: "好的", style: .default, handler: { action in print("点击了确定") }) alertController.addAction(cancelAction) alertController.addAction(okAction) self.present(alertController, animated: true, completion: nil) }

    有几处不理解的地方,请赐教~~谢谢大家。 1、handler: { action in print("点击了确定") 首先 handler:nil 是什么意思哦?如果后面加了 action...,又代表什么呢? 2、self.present 代表的是将这些常量输出出来吗? 3、completion: nil,代表执行完成以后不做任何操作嘛?

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2838 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 13:33 · PVG 21:33 · LAX 06:33 · JFK 09:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.