zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

ios swift [weak self]

ios swift self weak
2023-09-14 09:04:13 时间
  • 使用实例
  @objc func phoneBtnClick(){
        let vc = EWCountryCodeViewController()
        vc.backCountryCode = { [weak self] country, code in
            self?.phoneBtn.setTitle("+"+code, for: .normal)
        }
        present(vc, animated: true, completion: nil)
    }

相关博客:
Swift 闭包无脑加 [weak self] 行不行? - 知乎
关于 Swift 闭包上下文捕获的官方文档导读 - 知乎