block传值
//block传值(view向controller中的view中传值,也可以是controller向controller中传值)
//view中
//typealias的作用是用左边代替右边
//(Int)->Void代表传递的值是Int型的,返回值是void
typealias pushCarouselblock = (Int)->Void
//定义一个传值的变量pPushCarouselblock
var pPushCarouselblock:pushCarouselblock?
//待传递的值是indexOfCurrentImage(Int型)
pPushCarouselblock!(indexOfCurrentImage)
//controller页面中
self.headerView.pPushCarouselblock = { locationIn in
    //在该视图的view中通过此方式用
    //locationIn代表indexOfCurrentImage
}
通常controller向view传值跳转时带过去
view向controller传值用block
 
                    
                     
                    
                 
                    
                
 
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号