594747343
V2EX  ›  Swift

swift3-提示框问题 [小白]

  •  
  •   594747343 · Jun 28, 2017 · 3969 views
    This topic created in 3269 days ago, the information mentioned may be changed or developed.

    我想要写个点击 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,代表执行完成以后不做任何操作嘛?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3114 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 13:43 · PVG 21:43 · LAX 06:43 · JFK 09:43
    ♥ Do have faith in what you're doing.