1.设置根视图控制器
![](https://img.haomeiwen.com/i1942001/9ece7ec438fd332e.png)
2.在第一个 viewController 中懒加载创建 button 和 label
在 button 的点击方法中调用闭包的方法
![](https://img.haomeiwen.com/i1942001/dc367163b06f2534.png)
![](https://img.haomeiwen.com/i1942001/67943bc33cd0f26a.png)
![](https://img.haomeiwen.com/i1942001/7d8e41125ae50345.png)
3.在第二个控制器 SecondViewController 中懒加载创建 button 和 textfield
创建闭包,并在 button 的点击方法中实现闭包方法
![](https://img.haomeiwen.com/i1942001/136d38eeccc235f1.png)
![](https://img.haomeiwen.com/i1942001/3ff1a456eb0514eb.png)
![](https://img.haomeiwen.com/i1942001/0d9a5a85bb952ce0.png)
1.设置根视图控制器
2.在第一个 viewController 中懒加载创建 button 和 label
在 button 的点击方法中调用闭包的方法
3.在第二个控制器 SecondViewController 中懒加载创建 button 和 textfield
创建闭包,并在 button 的点击方法中实现闭包方法
本文标题:swift 闭包传值
本文链接:https://www.haomeiwen.com/subject/fcwydttx.html
网友评论