Ios 使用UIDynamicMator后图像模糊

Ios 使用UIDynamicMator后图像模糊,ios,cocoa-touch,uidynamicanimator,Ios,Cocoa Touch,Uidynamicanimator,我正在使用UIDynamicsAnimator,效果很好,只是在动画完成后,被推和反弹的图像变得模糊。请帮帮我 @property (nonatomic,weak) IBOutlet UIImageView *someImage; self.animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view]; self.gravity = [[UIGravityBehavior alloc] initWithItems

我正在使用UIDynamicsAnimator,效果很好,只是在动画完成后,被推和反弹的图像变得模糊。请帮帮我

@property (nonatomic,weak) IBOutlet UIImageView *someImage;

self.animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];

self.gravity = [[UIGravityBehavior alloc] initWithItems:@[self.someImage]];
CGVector gravityDirection = {-1.0, 0.5};
[self.gravity setGravityDirection:gravityDirection];

self.collision = [[UICollisionBehavior alloc] initWithItems:@[self.someImage]];
self.collision.translatesReferenceBoundsIntoBoundary = YES;

self.itemBehaviour = [[UIDynamicItemBehavior alloc] initWithItems:@[self.someImage]];
self.itemBehaviour.elasticity = 0.5;

[self.animator removeAllBehaviors]; // to avoid problems from the last behaviour animation

[self.collision addBoundaryWithIdentifier:@"barrier"
                               fromPoint:CGPointMake(444,0)
                               toPoint:CGPointMake(444,768)];

self.pushBehavior = [[UIPushBehavior alloc] initWithItems:@[self.someImage] mode:UIPushBehaviorModeInstantaneous];
self.pushBehavior.magnitude = 1.0f;
self.pushBehavior.angle = 0.0f;
[self.animator addBehavior:self.pushBehavior];

self.pushBehavior.pushDirection = CGVectorMake(1.0f, 0.0f)
self.pushBehavior.active = YES;

[self.animator addBehavior:self.itemBehaviour];
[self.animator addBehavior:self.collision];
[self.animator addBehavior:self.gravity];

我认为你的问题是,当动画完成时,图像不在一个精确的点上。我建议您添加一个代理,当动画暂停时,将图像的x和y四舍五入到最接近的整数。

图像的实际大小(以像素为单位)是多少?最终位置的坐标是整数还是分数?我通过将图像大小调整为高度和宽度的偶数来解决这个问题。也许问题在于UIDynamics需要将帧原点和视图中心都作为精确点。