I just want to add an effect of making the cells of UICollectionView, that looks like a chain or a connected links. Please help me what to do.
Asked
Active
Viewed 2,283 times
-2

Pradheep Narendran
- 39
- 8
-
I am looking for the same look on my app https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/CollectionViewPGforIOS/Art/flow_horiz_headers_2x.png – Pradheep Narendran Mar 23 '15 at 10:24
3 Answers
1
I guess the best solution is to insert 4 lines around your cell and only show/hide the one needed depending on the cell position. This solution implies that you know how your cells will be positioned against each other.

sweepy_
- 1,333
- 1
- 9
- 28
-
I've tried it and the problem is that I am using UIEdgeInsets – Pradheep Narendran Mar 23 '15 at 12:33
-
@PradheepNarendran Put your lines on top of all your cell subviews, so that it does not get affected by UIEdgeInsets applied to other subviews. If you apply UIEdgeInsets to your whole cell, you problem is unsolvable and you'll need to consider changing the way you build your cells. – sweepy_ Mar 23 '15 at 12:44
0
I guess you could try something like:
UIImage *image = [UIImage imageNamed:@"line.png"];
for (UICollectionViewCell *cell in youreCollectionView.subviews)
{
UIImageView *imageView = [[UIImageView alloc]initWithImage:image];
CGRect frame = imageView.frame;
frame.origin.x = CGRectGetMaxX(cell.frame);
frame.origin.y = cell.frame.size.height / 2 - image.size.height / 2;
imageView.frame = frame;
[youreCollectionView addSubview:imageView];
}

LoVo
- 1,856
- 19
- 21
-
Still not working.. Please open this file and it is the output that I am getting :- http://i60.tinypic.com/ipukqd.png – Pradheep Narendran Mar 23 '15 at 11:24
0
While creating ur cell.. U can call the following method with cell
- (void)drawSeparatorWithFrame:(CGRect)frame {
CALayer *separator = [CALayer layer];
separator.frame = frame;
separator.backgroundColor = [UIColor colorWithRed:166.0/255 green:181.0/255 blue:188.0/255 alpha:1.0f].CGColor;
[self.layer addSublayer:separator];
}

KP_G
- 460
- 4
- 15