귀하의 FilterCollectionCell
: 여기
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
{
EventHandler clickTarget = (sender, e) =>
{
if (this.parantController.showCategories)
{
this.parantController.apiCallGetBusinessesIndustries(this.parantController.businessesCategoriesResponseModel.business_categories[indexPath.Row].id);
this.parantController.showIndustries = true;
this.parantController.showCategories = false;
}
else if (this.parantController.showIndustries)
{
this.parantController.apiCallGetBusinessessList("", this.parantController.businessesIndustriesResponseModel.business_industries[indexPath.Row].id);
this.parantController.filterView.Hidden = true;
this.parantController.showVerticalList = false;
this.parantController.showIndustries = false;
this.parantController.clearAll = true;
this.parantController.filterCollectionView.ReloadData();
this.parantController.clearAll = false;
//this.parantController.showCategories = true;
}
};
var cell = (FilterCollectionCell)collectionView.DequeueReusableCell("filterCollectionCell", indexPath);
if (this.parantController.businessesCategoriesResponseModel.business_categories != null && !this.parantController.showIndustries)
{
cell.updateCell(false, this.parantController.businessesCategoriesResponseModel.business_categories[indexPath.Row].name, clickTarget);
}
if (this.parantController.showIndustries)
{
cell.updateCell(false, this.parantController.businessesIndustriesResponseModel.business_industries[indexPath.Row].name, clickTarget);
}
return cell;
}
내가 셀 뷰 컨트롤러의 버튼에 이벤트 처리기를 추가하는 코드는 다음과 같습니다 I 설정이 대리인의 셀 어디 여기
입니다 생성은 셀에 이벤트 적용을 처리해야하므로 셀이 재사용 될 때마다 GetCell
메서드 내에서 매번 새 이벤트를 추가하지 않습니다.
그렇지 않으면 모든 UButtons '목표를 검색하고 그들에게 셀이 요청 될 때마다 제거 할 수 있습니다
foreach (var target in button.AllTargets)
{
button.RemoveTarget(target, null, UIControlEvent.AllTouchEvents);
}
내가 FilterCollectionCell에 적용 이벤트를 처리 할 방법을? – linuxer
@SushiHanover 어떤 지침이 있습니까? – linuxer