Problem rotating all of the cells #99

scompt opened this Issue May 13, 2012 · 0 comments


None yet
1 participant

scompt commented May 13, 2012

In my app, I need a grid view where all of the cells are rotated by a random amount. The final appearance is that of cards scattered across the screen. I'm implementing this by setting a random rotation transform on the cell:

float high_bound = M_PI / 4;
float low_bound = -high_bound;
float rndValue = (((float)arc4random()/0x100000000)*(high_bound-low_bound)+low_bound);
cell.transform = CGAffineTransformMakeRotation(rndValue);

This results in the following:

Rotated cells

The problem is that GMGridView is modifying the frame here immediately after I create the cell. If I remove lines 1183 & 1184, I get the following, as expected:

Rotated cells

Simply removing those lines is probably not the correct solution. What would the right solution be? In GMGridView, only using the bounds and center properties? This would allow it to properly interact with any transformations set on the cells.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment