如何在按钮发送器中调用dispatch_block_t块函数?

时间:2018-12-05 13:33:29

标签: objective-c button

如何在按钮发送器中调用dispatch_block_t?当前,dispatch_block_t在HeadView下,停在viewForSupplementaryElementOfKind下。示例代码如下:-

    - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {

        UICollectionReusableView *reusableview = nil;

        if (kind == UICollectionElementKindSectionHeader){

            ProductMerchant_HeadView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:ProductMerchant_HeadViewID forIndexPath:indexPath];

            WEAKSELF
            headerView.filterClickBlock = ^{ //Click on filter header
                //something here.....
            };
 reusableview = headerView;  
    }
    if (kind == UICollectionElementKindSectionFooter) {

    }
    return reusableview;
}


- (void)clickFilterButton:(id)sender {
//HOW CAN I CALL headerView.filterClickBlock = ^{} HERE?
}

0 个答案:

没有答案