下面的动画显示屏幕左上角的 View (ipad):
[UIView beginAnimations:@"anim" context:nil];
[UIView setAnimationDuration:5];
[UIView setAnimationDelegate:self];
someView.frame = CGRectMake(0, 0, 1024, 768);
[UIView commitAnimations];
但是,它不会调整 View 大小(想想我想要炸毁的 UIImageView)。我假设我必须以某种方式通过变换来做到这一点,但我所能想到的就是缩放、旋转和平移(CGAffineTransformMakeRotation、CGAffineTransformMakeScale、CGAffineTransformMakeTranslation)
如何将 View 转换为特定的矩形?我不想要只是扩大规模。我需要将其拉伸(stretch)到 1024x768,无论初始大小如何。
最佳答案
每个 UIView
都包含一个 CoreAnimation 对象 ( CALayer ),用于显式动画:
摆脱所有-beginAnimations
等调用,只需使用这个:
someView.layer.bounds = CGRectMake(0, 0, 1024, 768);
关于iphone - 将 View 动画设置为新的宽度和高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3593439/