swift block。
B class中:
1. 然后typedef一下这个funcation:
typealias callbackfunc=(selectIndex:Int)->Void
2.var myFunc = callbackfunc?()
3.传递函数func initBack( mathFunction:(selectIndex:Int)->Void ){
myFunc = mathFunction
}
4.最后回调:
myFunc!(selectIndex: indexPath.row);
A class中写法:
xxx.initBack { (selectIndex) -> Void in
做点啥吧.
}