I have a photo gallery in my app. where i can select multiple photos and can delete them. All is going on very well.
I just need to implement apple's default selection behavior as we can see in camera roll.
Right now my selection is like this
I have implemented didSelectItemAtIndexPath method as follows -
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"Delegate cell %@ : SELECTED", [self formatIndexPath:indexPath]);
MyCustomCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
cell.label.backgroundColor=[UIColor greenColor];
}
- (NSString *)formatIndexPath:(NSIndexPath *)indexPath
{
return [NSString stringWithFormat:@"%ld", (long)indexPath.row+1];
}
And In MyCustomCell.m, I set the frame of label as rectangle as shown in fig (green).
And method setSelected looks like following:
- (void)setSelected:(BOOL)selected
{
UIView *blurView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 60, 70)];
blurView.backgroundColor=[UIColor whiteColor];
blurView.alpha=0.5;
blurView.opaque=YES;
if (selected) {
self.label.backgroundColor = [UIColor greenColor];
[self.imageThumb addSubview:blurView];
}
}
So, Is it possible to have apple's default selection behavior ??
Any help will be appreciated. Thanks in advance.