项目中遇到一个问题记录一下我的解决方案 如果有好的方案欢迎留言告知必定重谢
状态错乱是cell的重用导致的
// FilterTermCell *cell = (FilterTermCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"cellId" forIndexPath:indexPath];
改为
NSString *cellID =[NSStringstringWithFormat:@"cellId%ld%ld",indexPath.section,indexPath.row];
FilterTermCell*cell = (FilterTermCell*)[collectionViewdequeueReusableCellWithReuseIdentifier:cellIDforIndexPath:indexPath];
注意cellID需要根据你请求的数据事先registerClass