0

I attached images what I have done and what I have to achieve. Please guide me to achieve this.

I have done till now:

I did

I want to achieve the following:

Want to achieve

Here is my code:

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    CGSize size; 
    if (indexPath.row == DIGIT_INT_2 || indexPath.row == DIGIT_INT_6 || indexPath.row == DIGIT_INT_7)
        size = CGSizeMake(150, 68); 
    else if (indexPath.row == DIGIT_INT_3 || indexPath.row == 13)
        size = CGSizeMake(150, 150);
    else
        size = CGSizeMake(68, 68);
    return size;
}
Azat
  • 6,745
  • 5
  • 31
  • 48
Ravi Sharma
  • 975
  • 11
  • 29
  • 1
    Please share the relevant parts of your code because it's super hard to help otherwise. – Wai Ha Lee May 15 '15 at 11:27
  • @WaiHaLee thanks for reply sir till now i added the uicollectionview and added defined the size of items using flow layout delegate method:-- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {CGSize size; if (indexPath.row == DIGIT_INT_2 ||indexPath.row == DIGIT_INT_6 || indexPath.row == DIGIT_INT_7) {size = CGSizeMake(150, 68); }else if (indexPath.row == DIGIT_INT_3 ||indexPath.row == 13) {size = CGSizeMake(150, 150);}elsesize = CGSizeMake(68, 68);return size;} – Ravi Sharma May 15 '15 at 12:21
  • 1
    I meant to [edit](http://stackoverflow.com/posts/30258206/edit) your question to include the code. That way, you can have formatted code so that it's easier to read. – Wai Ha Lee May 15 '15 at 12:58
  • Have you looked at [RFQuiltLayout](https://github.com/bryceredd/RFQuiltLayout)? – Azat May 17 '15 at 14:00
  • Thanks Azat for your reply i solved it by my way. – Ravi Sharma May 18 '15 at 06:37

1 Answers1

0

i find the answer and i achieved it by customise the UICollectionViewFlowLayout class and inheriting the method - (NSArray *) layoutAttributesForElementsInRect:(CGRect)rect and play with the previous item frame and current item frame.

But after this a new problem came one item disappear after scrolling. I failed to find why this happening. After two days work i have to move another way to achieve this. Thanks Wai Ha Lee for formatting the question.

Now my disappear problem solved by this question:- UICollectionView's cell disappearing

Community
  • 1
  • 1
Ravi Sharma
  • 975
  • 11
  • 29