Block笔记
此处不可以使用strongself和self会导致内存泄露,list就是typeList,会持有UserRepeatClickSelectIndexBlock,UserRepeatClickSelectIndexBlock持有self,self又会持有typeList
typeof(self) __weak weakself = self;
_typeList = [[ChooseEventList alloc] initWithFrame:CGRectMake(0, 0, YDScreenSize().width, DWF(45)) itemInfoArray:self.indexPageTypeList.copy configurationBlock:^(ChooseEventList *list) {
typeof(weakself) __strong strongself = weakself;
[list setUserRepeatClickSelectIndexBlock:^(ChooseEventList *list, NSInteger chooseIndex) {
switch (weakself.indexPageTypeList[chooseIndex].integerValue) {
case YDIndexPageExamination:
case YDIndexPageWookShop:
{
[weakself setSelectedIndex:chooseIndex];
}
break;
default:
break;
}
}];
}];