我正在尝试选择UIcollectionCell#20并更改viewWillAppear中的颜色。这是我在viewWillAppear中的代码。
[self.periodCollectionView selectItemAtIndexPath:[NSIndexPath indexPathForRow:20 inSection:0] animated:YES scrollPosition:UICollectionViewScrollPositionCenteredHorizontally];
selectedCell = (ViewPeriodCollectionCell *)[self.periodCollectionView cellForItemAtIndexPath:[NSIndexPath indexPathForRow:20 inSection:0]];
[selectedCell setButtonSelected:YES];
这在-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
请帮助,谢谢。