views:

39

answers:

1

I would like to shrink my UIView to the top left corner. I am currently using a scale transform to achieve this, but the view is shrunk to the center. I have tried to change the layer's anchorpoint, but this results in the entire view changing position on screen . How should a transform be set up to achieve a shrink to the top left corner? Thank you

+1  A: 

Something like:

[UIView beginAnimations:nil context:nil];
// setAnimationDuration
// set transform scaling
myView.center = CGPointMake (0, 0);
[UIView commitAnimations];

If you are transforming it to something like 50% of the screen you can change the center point to where it should be. For example, if it's a 320x480 view, you'll be scaling it to 160x240...so the center point will need to be 160/2 (80) and 240/2 (120)...

Jeffrey Berthiaume
Thank you, that worked very well.
Run Loop
A better way to do that would be to just set the frame to `CGPointZero`, avoiding the need for the transform.
chpwn