Hey
I have a strange problem when trying to rotate a UIView. I wonder if anyone can help me.
I have a UIView to which I add a number of subviews:
Code:
// Set the pickLayers up in a vector
pickLayers.resize( maxDivisions, 0 );
for( unsigned int i = 0; i < maxDivisions; ++i )
{
// Create a new layer
pickLayers[i] = [[CALayer layer] retain];
// Set up the properties that will be reusable
pickLayers[i].opaque = NO;
pickLayers[i].backgroundColor = CGColorCreateGenericRGB( 1.0f, 1.0f, 1.0f, ( ( float )i / ( float )maxDivisions ) )
// Show the layer
pickLayers[i].hidden = NO;
pickLayers[i].frame = CGRectMake( 0.0f, ( divisionHeight * i ), divisionWidth, divisionHeight );
// Add this to the view
[pickerView.layer addSublayer:pickLayers[i]];
}
When I show and hide the view all works well. I get a set of sublayers arranged correctly on the view.
However if I try to rotate the view:
Code:
pickerView.transform = CGAffineTransformMakeRotation( M_PI / 2.0f );
...I can't see the sub layers any more. I have tried resetting their positions after the rotate but it doesn't help.
Setting the transform to identity instead of the above is fine:
Code:
pickerView.transform = CGAffineTransformIdentity;
Has anyone come across this?
Am I doing something fundamentally wrong?
Thank you