V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
594747343
V2EX  ›  Swift

swift3-提示框问题 [小白]

  •  
  •   594747343 · Jun 28, 2017 · 3890 views
    This topic created in 3233 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   ·   2483 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 15:40 · PVG 23:40 · LAX 08:40 · JFK 11:40
    ♥ Do have faith in what you're doing.