尝试混合UIKit Dynamics UICollision和core动画来缩放长方体';界
从我之前的一个问题。 我尝试在一个上面有一个小盒子的盒子上混合动画缩放效果。 这两个盒子都有UICollisionBehavior,我想最终让底部盒子变得更大,足够快,提供一个速度力,让顶部盒子反弹 下面是刻度代码。当视图中的图像仍在缩放时,边界立即设置为其最终目标。我希望边界和图像同时缩放,这样我就可以看到预期的反应发生尝试混合UIKit Dynamics UICollision和core动画来缩放长方体';界,uikit,core-animation,Uikit,Core Animation,从我之前的一个问题。 我尝试在一个上面有一个小盒子的盒子上混合动画缩放效果。 这两个盒子都有UICollisionBehavior,我想最终让底部盒子变得更大,足够快,提供一个速度力,让顶部盒子反弹 下面是刻度代码。当视图中的图像仍在缩放时,边界立即设置为其最终目标。我希望边界和图像同时缩放,这样我就可以看到预期的反应发生 - (IBAction)tapBoxThing:(UITapGestureRecognizer *)sender { /* Make sure no trans
- (IBAction)tapBoxThing:(UITapGestureRecognizer *)sender {
/* Make sure no translation is applied to this image view */
_boxView.transform = CGAffineTransformIdentity;
/* Begin the animation */
[UIView beginAnimations:nil
context:NULL];
/* Make the animation 5 seconds long */
[UIView setAnimationDuration:5.0f];
[_gravity removeItem:_boxView];
[_collision removeItem:_boxView];
// right here, the box will animate the image in the view to slowly fill in the new bounds.
// But I want the bounds to animate, its currently instantly scaling to teh final ammount.
// Core Animation states that frame is not animatable but bounds is.
CGRect frameZ = _boxView.bounds;
frameZ.size.height += 60.0f;
frameZ.size.width += 60.0f;
_boxView.bounds = frameZ;
[_gravity addItem:_boxView];
[_collision addItem:_boxView];
[UIView commitAnimations];
}