Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Resizing Tiles #13

Open
awaistariq opened this issue Nov 19, 2013 · 0 comments
Open

Auto Resizing Tiles #13

awaistariq opened this issue Nov 19, 2013 · 0 comments

Comments

@awaistariq
Copy link

Hello,
I have been playing with RFQuiltLayout.
Basically I need a layout like ZigZag tiles, something like this
|^|
|^
|
|**^|

The first three rows gets drawn properly but later it auto resize the tiles and start messing with it.
Anyone can help?

screenshot 2013 11 18 17 03 53

Here is the code:
int counter = 4;

pragma mark – RFQuiltLayoutDelegate

- (CGSize) blockSizeForItemAtIndexPath:(NSIndexPath *)indexPath {

NSLog(@"%d and Row: %d",counter % 4, indexPath.row);

if(counter % 4 >= 2)
{
    counter++;

    if(indexPath.row >= self.numbers.count)
        NSLog(@"Asking for index paths of non-existant cells!! %d from %d cells", indexPath.row, self.numbers.count);

    if (indexPath.row % 2 == 0) {
        return CGSizeMake(2, 1);
    }else
    {
        return CGSizeMake(1, 1);
    }
}
else
{
    counter++;
    if(indexPath.row >= self.numbers.count)
        NSLog(@"Asking for index paths of non-existant cells!! %d from %d cells", indexPath.row, self.numbers.count);

    if (indexPath.row % 2 == 0) {
        return CGSizeMake(1, 1);
    }else
    {
        return CGSizeMake(2, 1);
    }
  }


}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant