if([self.delegate respondsToSelector:@selector(LJProductHeadViewCategoryClick:Select:)]){
[self.delegate LJProductHeadViewCategoryClick:self Select:YES];
}
@class LJProductHeadView;
@protocol LJProductHeadViewDelegate <NSObject>
@optional
-(void)LJProductHeadViewCategoryClick:(LJProductHeadView *)headView Select:(BOOL)isSelect;
-(void)LJProductHeadViewSortClick:(LJProductHeadView *)headView Select:(BOOL)isSelect;
@end
@property(weak,nonatomic)id<LJProductHeadViewDelegate> delegate;
3、在在要发生事件的控制器中的实现文件中 添加代理
cell.delegate=self;
4、在要发生事件的控制器中的实现文件中 实现代理方法
@interface LJProductListViewController () <LJProductHeadViewDelegate>
#pragma LJHeadViewDelegate
-(void)LJProductHeadViewSortClick:(LJProductHeadView *)headView Select:(BOOL)isSelect{
if(isSelect){
LJSortView *sortView =[[LJSortView alloc]init];
sortView.backgroundColor=[UIColor whiteColor];
CGFloat sortViewW=self.view.width;
CGFloat sortViewH=400;
CGFloat sortViewX=0;
CGFloat sortViewY=CGRectGetMaxY(self.headView.frame)-400;
sortView.frame=CGRectMake(sortViewX,sortViewY , sortViewW, sortViewH);
[UIView animateWithDuration:0.3 animations:^{
sortView.transform = CGAffineTransformMakeTranslation(0, sortViewH);
}];
self.sortView=sortView;
[self.view addSubview:sortView];
}else{
[UIView animateWithDuration:0.3 animations:^{
self.sortView.transform = CGAffineTransformIdentity;
[self.sortView removeFromSuperview];
}];
}
}
-(void)LJProductHeadViewCategoryClick:(LJProductHeadView *)headView Select:(BOOL)isSelect{
if(isSelect){
}else{
}
}