Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 07-10-2009, 05:13 AM   #1 (permalink)
Gillies
Registered Member
 
Join Date: Mar 2009
Location: UK
Posts: 20
Default Sub-Layers Disappear when Changing UIView Transform

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
Gillies is offline   Reply With Quote
 

» Advertisements
» Online Users: 348
15 members and 333 guests
ADY, BdR, dacapo, fiftysixty, F_Bryant, john love, kampftrinker, ligerligerliger, mer10, mizzytheboy, nobre84, syver, themathminister, XRumerTest
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,876
Threads: 89,225
Posts: 380,701
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jorge599
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:29 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.