Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone ($4.99)

dotnetIQ ($4.99)

Your First iPhone App ($1.99)

iPocket Tools 9 in 1 ($0.99)

Catch-Me (Free)

Alien Strike ($0.99)

Historic Olympic Medal-Table ($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-10-2009, 05:13 AM   #1 (permalink)
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
Old 07-10-2009, 06:12 AM   #2 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: UK
Posts: 20
Default

Sorry folks.
I was making a mistake setting the frame property in parallel with this.
Still don't get the transform/centre/bounds/frame relationship.
Gillies is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


» Advertisements
» Stats
Members: 21,505
Threads: 35,786
Posts: 156,783
Top Poster: smasher (2,449)
Welcome to our newest member, SimonK
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:12 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0