Swift 闭包传值 反向传值
2017-03-07 16:35
1101 查看
RT
A界面 接收B界面返回的时候的值
A界面
let vc = CZHourPicker()
vc.backClosure = {(backStr: String) -> Void in
self.durationBtn.setTitle(backStr, for: UIControlState.normal)
self.durationBtnT.setTitle(backStr, for: UIControlState.normal)
}
self.present(vc, animated: true, completion: nil)
B界面
//定义闭包类型(特定的函数类型函数类型)
typealias InputClosureType = (String) -> Void
//接收上个页面传过来的闭包块
var backClosure: InputClosureType?
self.backClosure!(resultStr)
self.dismiss(animated: true, completion: nil)
A界面 接收B界面返回的时候的值
A界面
let vc = CZHourPicker()
vc.backClosure = {(backStr: String) -> Void in
self.durationBtn.setTitle(backStr, for: UIControlState.normal)
self.durationBtnT.setTitle(backStr, for: UIControlState.normal)
}
self.present(vc, animated: true, completion: nil)
B界面
//定义闭包类型(特定的函数类型函数类型)
typealias InputClosureType = (String) -> Void
//接收上个页面传过来的闭包块
var backClosure: InputClosureType?
self.backClosure!(resultStr)
self.dismiss(animated: true, completion: nil)
相关文章推荐
- Swift利用闭包(closure)来实现传值-->前后两个控制器的反向传值
- Swift利用闭包反向传值
- Swift利用闭包(closure)回实现传值->前后两个控制器的反向传值
- Swift利用闭包(closure)来实现传值-->前后两个控制器的反向传值
- Swift 正向传值以及利用闭包(closure)实现反向传值(七)
- Swift利用闭包(closure)来实现传值-->前后两个控制器的反向传值
- [ios][swift]使用swift闭包进行viewcontroller反向传值
- Swift之delegate代理和Block闭包的反向传值
- Swift 使用代理和闭包(closure)反向传值
- Swift利用闭包(closure)来实现传值-->前后两个控制器的反向传值
- Swift利用闭包(closure)来实现传值-->前后两个控制器的反向传值
- Swift 视图控制器间传值(正向和反向)
- swift基础利用闭包在两个视图界面传值
- Swift中闭包实现OC的block传值
- swift页面传值之block(闭包)传值
- swift开发使用闭包传值
- Swift 闭包(Closures)传值
- swift2.0 用闭包表达式 代替 protocol 传值回调
- OC 与 Swift混编 Swift的闭包传值到OC中
- Swift: 比较Swift中闭包传值、OC中的Block传值