如何在viewWillAppear中选择和更改Collection Cell的背景

时间:2014-05-22 19:30:12

标签: ios objective-c uicollectionview uicollectionviewcell

我正在尝试选择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

中工作正常

请帮助,谢谢。

0 个答案:

没有答案