views:

27

answers:

2

The following animates a view to the upper left part of the screen (ipad):

[UIView beginAnimations:@"anim" context:nil];
[UIView setAnimationDuration:5];
[UIView setAnimationDelegate:self];
    someView.frame = CGRectMake(0, 0, 1024, 768);
[UIView commitAnimations];

However, it does not resize the view (think of a UIImageView that I want to blow up). I assume I have to do that with a transform somehow, but all I can figure out how to do is scale, rotation, and translation (CGAffineTransformMakeRotation, CGAffineTransformMakeScale, CGAffineTransformMakeTranslation)

How do you transform a view to a specific rectangle? I don't want just a scale up. I need to stretch it to 1024x768, regardless of the intitial size.

A: 

Every UIView contains a CoreAnimation object (CALayer), which is used for explicit animations:

Get rid of all the -beginAnimations etc calls and just use this:

someView.layer.bounds = CGRectMake(0, 0, 1024, 768);
Brock Woolf
Thanks for the suggestion. I'm getting this though:error: accessing unknown 'bounds' component of a property
sol
[someView.layer setBounds:CGRectMake(0, 0, 1024, 768)];Still just moves it up to the upper left. Doesn't blow it up :(
sol
A: 

What is your view contentMode set to? You should try setting it to this:

someView.contentMode = UIViewContentModeScaleToFill;

Edit: Make sure you do this before the animation block. You should set it in Interface Builder or in the one the view loading methods: loadView or viewDidLoad.

bstahlhood