項目中遇到一個問題記錄一下我的解決方案 ?如果有好的方案歡迎留言告知必定重謝
狀態(tài)錯亂是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需要根據(jù)你請求的數(shù)據(jù)事先registerClass