Как изменить фон в ячейке, если я знаю номер раздела и номер позиции? В приведенном ниже коде показано, как я пытался это сделать.UICollectionviewcell change background
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
CalendarCollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"cellIdentifier" forIndexPath:indexPath];
cell.titleLabel.text = [NSString stringWithFormat:@"%i",indexPath.item-dayStart+2];
if (indexPath.section == todayMonthSection && indexPath.item == dayPlusShift){
cell.backgroundColor = [UIColor colorWithRed:60.0/255.0 green:162.0/255.0 blue:161.0/255.0 alpha:1];
cell.titleLabel.textColor = [UIColor whiteColor];
}
return cell;
Но если я это сделаю во время прокрутки, нарисовал не только соответствующую ячейку.
На самом деле, в чем проблема? Cell.backgroundcolor не работает? –