【发布时间】:2015-07-18 05:03:18
【问题描述】:
如果选择了单元格,则我使用此代码,然后背景颜色必须在图像视图中更改,它位于集合视图单元格内。 但它不起作用
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
if (cell.selected) {
cell.img_cell.backgroundColor = [UIColor colorFromHexString:@"#ffc400"]; // highlight selection
}
else
{
cell.backgroundColor = [UIColor clearColor]; // Default color
}
NSLog(@"Selected section>> %@",[arr_images objectAtIndex:indexPath.row]);
// cell.backgroundColor=[UIColor colorFromHexString:@"#ffc400"];
}
【问题讨论】:
标签: ios objective-c uicollectionview uicollectionviewcell uicolor