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, CGAffin开发者_如何学GoeTransformMakeScale, 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.
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);
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.
精彩评论